3Commas 交易机器人 API
通过 3Commas WebSocket 网关,跨多个交易所管理自动交易机器人、交易和智能交易。
通过 3Commas WebSocket 网关,跨多个交易所管理自动交易机器人、交易和智能交易。
通过 3Commas 交易机器人平台的 WebSocket 网关流式传输交易和智能交易更新。配合 TsgcWebSocketClient 作为传输层。
TsgcWSAPI_ThreeCommas
Windows, macOS, Linux, iOS, Android
Standard / Professional / Enterprise
将 TsgcWebSocketClient 连接到 API 组件,在 ThreeCommas 组中设置 ApiKey / ApiSecret,然后调用 SubscribeDeals 或 SubscribeSmartTrades。
uses
sgcWebSocket, sgcWebSocket_API_ThreeCommas;
var
WSClient: TsgcWebSocketClient;
ThreeCommas: TsgcWSAPI_ThreeCommas;
begin
WSClient := TsgcWebSocketClient.Create(nil);
ThreeCommas := TsgcWSAPI_ThreeCommas.Create(nil);
ThreeCommas.Client := WSClient;
ThreeCommas.ThreeCommas.ApiKey := 'your-api-key';
ThreeCommas.ThreeCommas.ApiSecret := 'your-api-secret';
WSClient.Active := True;
ThreeCommas.SubscribeDeals;
ThreeCommas.SubscribeSmartTrades;
end;
// uses: sgcWebSocket, sgcWebSocket_API_ThreeCommas
TsgcWebSocketClient *WSClient = new TsgcWebSocketClient(this);
TsgcWSAPI_ThreeCommas *ThreeCommas = new TsgcWSAPI_ThreeCommas(this);
ThreeCommas->Client = WSClient;
ThreeCommas->ThreeCommas->ApiKey = "your-api-key";
ThreeCommas->ThreeCommas->ApiSecret = "your-api-secret";
WSClient->Active = true;
ThreeCommas->SubscribeDeals();
ThreeCommas->SubscribeSmartTrades();
针对 3Commas WebSocket 网关的类型化封装器,支持 HMAC 签名订阅和事件驱动的数据分发。
SubscribeDeals / UnSubscribeDeals 在服务端打开 DealsChannel。组件在已连接交易所的机器人触发时,分发交易创建/更新/关闭事件。
SubscribeSmartTrades / UnSubscribeSmartTrades 打开 SmartTradesChannel,用于接收所有活跃智能交易订单的状态变更(成交中、已完成、已取消)。
Set ThreeCommas.ApiKey and ThreeCommas.ApiSecret — the component computes the per-channel HMAC-SHA256 identifier 3Commas requires for private streams.
Bind to any TsgcWebSocketClient via Client. WatchDog, HeartBeat, Authentication and TLS settings live on the WebSocket client — this component focuses on protocol framing.
OnConnect, OnDisconnect, OnException propagate from the underlying client. OnMessage exposes every raw frame for logging or custom routing.
在同一窗体上添加 TsgcWSAPI_Binance 或 TsgcWSAPI_Coinbase 等兄弟组件,将 3Commas 机器人事件与底层交易所行情关联。
本组件所实现 API 的权威参考来源。