AI-native runtime for Gate.io trading strategies
Author in Cursor, Claude Code or any AI IDE. Deploy from GitHub into a managed cloud runtime with first-class MCP control, logs and region selection.
Section 01 · At a glance
At a glance
- Venue
- Gate.io (also branded Gate.com since the 2024 rebrand, with Gate.io still in active use for API and SDK references)
- Venue type
- Crypto exchange (spot, margin, USDT/BTC-margined perpetual, delivery futures, options, copy trading, lending)
- Asset class
- Crypto
- Supported products
- Spot (4,600+ assets), cross and isolated margin (~470 assets, up to 10x), USDT-margined perpetual, BTC-margined perpetual, delivery futures, options on BTC/ETH/select majors (short-dated 1h/4h/24h plus standard expiries), copy trading, lending. Max leverage on derivatives up to 125x.
- Runtime model
- Containerised strategy runtime
- Deployment source
- GitHub
- Languages
- Any language that runs in a container
- Common integrations
- Native Gate API v4 (REST + WebSocket), CCXT (exchange id `gate`), Freqtrade (spot + perpetual futures), Hummingbot (`gate_io` and `gate_io_perpetual`), custom
- AI workflow integration
- MCP control surface for Cursor, Claude Code, GitHub Copilot and CLI agents
- TradingHost role
- Runtime, deployment, logs, health checks, region selection, secrets injection, MCP control
- Gate.io role
- Exchange account, API key issuance, market data, order routing, custody, settlement
- Affiliation
- TradingHost is independent and is not affiliated with Gate.io. Gate.io has been blocked from mainland China since September 2021 and is not available to US persons.
Section 02 · What Gate.io offers
What Gate.io offers
Gate.io offers spot across 4,600+ assets, cross and isolated margin, USDT-margined and BTC-margined perpetuals, delivery futures, options on BTC, ETH and select majors, copy trading and lending through a single Gate API v4 surface (REST + WebSocket). Strategies authenticate with HMAC-SHA512-signed keys; Futures TestNet runs at a separate host with its own keys, and spot has no public sandbox. Endpoint specifics change over time. The shape is durable; the precise rate-limit weights, fee tiers and symbol lists live in Gate.io's docs.
Markets and strategy patterns
- Long-tail altcoin spot rotation
- Cross-venue perp arbitrage (USDT-margined)
- BTC-margined perp basis and funding capture
- Options on BTC and ETH (short-dated 1h/4h/24h or standard expiries)
- Cross and isolated margin trading
- Copy-trading signal mirroring
- Demo (Futures TestNet) sandbox runs
- Sub-account hierarchy for strategy isolation
API surface
- Product surfaces
- Spot REST at `https://api.gateio.ws/api/v4` (spot endpoints under `/spot/*`, margin under `/margin/*`); Futures REST live at `https://api.gateio.ws/api/v4/futures/{usdt,btc}` (alt host `https://fx-api.gateio.ws/api/v4`); Options REST at `/api/v4/options`. Futures TestNet at `https://fx-api-testnet.gateio.ws/api/v4` with separate API keys. Spot has no public sandbox.
- Connection methods
- REST v4 (JSON over HTTPS), WebSocket v4 with separate sockets per market: Spot at `wss://api.gateio.ws/ws/v4/`, Futures USDT at `wss://fx-ws.gateio.ws/v4/ws/usdt`, Futures BTC at `wss://fx-ws.gateio.ws/v4/ws/btc`, TestNet at `wss://fx-ws-testnet.gateio.ws/v4/ws/{usdt,btc}`. API v2 was retired September 1, 2023.
- Authentication
- HMAC-SHA512 signing with three required headers on private endpoints: `KEY` (API key), `Timestamp` (Unix seconds), `SIGN` (hex HMAC-SHA512 of the signature string). Signature string: `Method + "\n" + URL_Path + "\n" + QueryString + "\n" + HexEncode(SHA512(Body)) + "\n" + Timestamp`. Sub-account hierarchy with main-to-sub asset transfer only (no sub-to-sub).
For specifics, refer to Gate.io
Specific endpoints, rate-limit weights, symbol lists, fee tiers and version history live in Gate.io's documentation. Treat these as the source of truth.
Section 03 · Build with AI
Build your Gate.io strategy with AI
Pick an integration method, fork a TradingHost framework starter, and author your strategy in an AI IDE. Cursor, Claude Code, GitHub Copilot and CLI-based AI agents all work with the same GitHub-native deployment loop.
Native Gate API v4
Direct control over Gate.io-specific behaviour, sub-account routing and order execution logic across spot, margin, perpetuals, delivery futures and options.
CCXT
Common interface across Gate.io and other crypto exchanges. Use exchange id `gate` (the active class; `gateio` still resolves and inherits from `gate`).
Freqtrade or Hummingbot
Framework-based deployments using their strategy structure and configuration model. Freqtrade covers Gate.io spot and USDT-margined perpetuals; Hummingbot ships `gate_io` and `gate_io_perpetual` connectors.
Custom connector
Your own internal trading engine or proprietary Gate.io integration.
Framework support for Gate.io products
Coverage varies by framework. CCXT spans the broadest Gate.io surface (spot, margin, perp, partial options); Freqtrade covers spot and USDT-margined perpetuals; Hummingbot ships spot and perpetual connectors; native Gate API v4 access covers everything Gate.io offers, including options on BTC, ETH and select majors.
✓ confirmed support per official framework docs. "partial" indicates limited or market-data-only coverage. "no" indicates not officially documented as supported. "n/a" indicates the framework does not model that product surface. Workflow links target /workflows/ pages currently in authoring.
TradingHost does not force a framework. It runs your project.
Author with AI
The framework starters above pair naturally with AI IDEs. The TradingHost MCP control surface closes the loop: AI tools can inspect deployments, review logs and manage the runtime alongside you, never the trade execution path.
Section 04 · Run on TradingHost
Run your code on TradingHost
Gate.io provides the exchange and API access. TradingHost provides the production environment where your Gate.io-connected strategy runs.
Instead of running strategy code on a laptop, desktop machine, generic VPS or manually configured server, you deploy from GitHub into a TradingHost-managed container runtime.
You
- Your repo contains your code.
- Your deployment defines how it runs.
- Your strategy connects to Gate.io.
TradingHost
- Keeps the runtime online.
- Surfaces logs and health checks.
- Region selection.
- Controlled deployment surface.
Deployment flow
- STEP 01
Connect GitHub
Authorise TradingHost to access your GitHub account.
- STEP 02
Link a repo or start from a framework
Point TradingHost at your existing strategy repo, or fork a TradingHost framework runtime (CCXT, Freqtrade or Hummingbot) for a working baseline.
- STEP 03
Deploy into a TradingHost container
Pick a region (EU or US-East), supply the environment values your strategy needs (Gate.io API v4 keys plus the HMAC-SHA512 signing pattern), and deploy. TradingHost builds your container from the repo and runs your strategy on managed Kubernetes infrastructure. No local Docker install required.
- STEP 04
Monitor logs and health
Watch live logs, health and runtime state from the TradingHost dashboard. The same surface is reachable through MCP from any AI IDE, so Cursor, Claude Code or a CLI agent can read deployment state and manage the runtime alongside you.
- STEP 05
Update and redeploy
Push changes to your GitHub main branch and TradingHost redeploys automatically.
Section 05 · Operational notes
Operational notes for Gate.io
Things that bite you when you actually run a Gate.io strategy in a containerised cloud runtime, not in Gate.io's docs, not in framework READMEs. Every claim below is quoted or paraphrased from Gate.io's own documentation; the deployment-side guidance is from running these strategies on TradingHost.
01 · API v4
v2 retired September 2023, v4 is the only path
API v2 was sunset September 1, 2023; legacy v2 keys no longer authenticate and any orders or cancellations against v2 fail silently or 401. Every Gate.io integration today should target v4 endpoints under api.gateio.ws/api/v4.
02 · Signing
HMAC-SHA512, hex-encoded, with body-hash baked in
Most competitor venues sign with SHA256. The Gate signature string interleaves \n between method, path, query, hex-SHA512 of body, and timestamp, and the output is hex (not base64). Mis-ordered components or wrong hash width are the most common 401 cause. Headers: KEY, Timestamp (Unix seconds), SIGN (hex).
SourceGate API v4 reference03 · Sub-accounts
Main-to-sub only, separate API keys recommended
Asset transfers can only flow main to sub (no sub to sub). VIP tier and trading-volume credits accrue to the main account. Issue separate API keys per sub-account to isolate strategies and risk, so a compromised key or runaway strategy is scoped to that sub-account rather than the whole book.
SourceGate sub-account guide04 · WebSocket
Private channels need signed subscribe payloads
Private channels require signed subscribe payloads (channel, event: "subscribe", auth). Spot, USDT futures, BTC futures, options and delivery each have their own socket; do not multiplex. A strategy that opens one socket and expects all four market types to arrive will see silent gaps.
05 · Futures TestNet
Demo at fx-api-testnet, separate keys
Demo trading runs at fx-api-testnet.gateio.ws with separate API keys (production keys 401 there). Spot has no public sandbox, so dry-runs against spot should use Freqtrade dry_run or CCXT recording rather than a venue sandbox. Keep TestNet and production secrets in separate TradingHost Secrets entries; never reuse one across environments.
06 · Geo restrictions
US and mainland China blocked
US persons and mainland China residents cannot trade on Gate.io. Other restricted regions include Canada, Singapore, UK, Malta, and several sanctioned jurisdictions. Strategies must not be operated for the benefit of residents in these regions. Confirm the licensed entity for your account before deploying.
07 · Common errors
INVALID_SIGNATURE, INVALID_PARAM_VALUE, stop-loss limit only
INVALID_SIGNATURE (signature string ordering or body hash); INVALID_PARAM_VALUE on withdrawal endpoints (chain field required); stop-loss market not supported (use limit); POINT-paid fees break automatic fee inference; API keys without IP whitelist expire at 90 days. Log the raw pre-hash string in non-production builds to triage signature failures quickly.
SourceGate API v4 reference
Section 06 · Built for
Built for
TradingHost Gate.io runtimes are best suited to:
- Long-tail altcoin traders running cross-section momentum or mean-reversion on the deep asset universe
- Perp arbitrage and basis traders running USDT-margined or BTC-margined perp legs
- Options writers and dispersion strategies trading BTC/ETH short-dated and standard expiries
- Copy-trading operators managing follower flow against a master sub-account
- AI-IDE developers building strategies in Cursor or Claude Code against CCXT `gate`, Freqtrade, or native v4
Connecting GitHub and creating your first strategy is free.
Section 08 · FAQ
FAQ
No. TradingHost is independent and is not affiliated with Gate.io.
No. Your strategy code connects to Gate.io and sends instructions according to your own logic, account permissions and integration method. TradingHost provides the runtime where that code runs.
No. Gate.io API access is provided by Gate.io. You are responsible for your Gate.io account, API permissions, credentials and compliance with Gate.io’s terms.
No. TradingHost is the cloud runtime where your strategy code runs. We do not provide signals, AI prediction models or pre-built strategies. With TradingHost you write or generate the strategy yourself (often with Cursor or Claude Code), keep it in GitHub as your code, and use TradingHost to run it in production. 3Commas, Cryptohopper and similar products own the strategy logic; TradingHost runs your strategy.
AWS and DigitalOcean give you raw compute. You handle OS updates, container orchestration, log shipping, secret rotation, region failover and uptime monitoring yourself. TradingHost gives you a managed runtime purpose-built for trading strategies: GitHub-native deployment, MCP-driven control from AI IDEs, log and health surfaces out of the box. If you want to operate the infrastructure yourself, AWS works. If you want the runtime as a managed service, TradingHost is the shorter path.
Yes. TradingHost runs Python strategies; pick the framework runtime that matches your stack or deploy your own repo.
Yes. TradingHost supports any language that can run inside a container.
Use `gate`. That is the active class. `gateio` still resolves and inherits from `gate`, but new code should use `gate`. Initialise with ccxt.gate({"apiKey": ..., "secret": ..., "options": {"defaultType": "swap"}}) for USDT-margined perps, "spot" for spot, "future" for delivery, "option" for options. See the CCXT framework runtime for the full setup story.
Yes, if your project is designed that way. You can run multiple strategy processes or services inside one runtime, or separate them into different runtimes for isolation and operational clarity. See the TradingHost runtime page for the multi-strategy model.
The fastest path is to fork a TradingHost framework runtime: CCXT, Freqtrade or Hummingbot for a ready-to-deploy project. Or connect your own GitHub strategy repo. Linking a GitHub repo and creating a strategy is free; runtime plans are listed on the pricing page.
In your GitHub-controlled secrets workflow. TradingHost reads them at runtime through GitHub repository secrets, environment secrets or your own approved secret-management process. TradingHost does not need custody of your API key and secret. See platform secrets for the full handling model.
No. Strategies should never need withdrawal permissions. Use scoped v4 permissions (Spot Trade, Perpetual Futures, etc.) and bind the key to your runtime's egress IP using Gate.io's IP whitelist. Keys without an IP whitelist expire at 90 days.
Yes, that's the recommended pattern on Gate. Create sub-accounts under the main account, issue a dedicated API v4 key per sub-account (with the minimum permissions the strategy needs), and let TradingHost inject the key as a secret. Sub-account volume and VIP tier still roll up to the main account, but blast radius from a compromised key or runaway strategy is scoped to that sub-account. Assets can only move main to sub, never sub to sub.
Yes. TradingHost supports MCP-based control for AI IDEs including Cursor, Claude Code, GitHub Copilot and CLI-based AI agents. AI tools can inspect deployments, review logs, restart strategies and manage runtime workflows. MCP is a control and observability surface, not the trade execution path. See the MCP control surface for the full picture.
Both. The MCP control surface works equally well from CLI-based agents (Claude Code CLI, custom MCP clients, scripted MCP calls) and from inside an IDE. The GitHub-native deployment loop also works without any AI tooling: a regular git push to your main branch triggers a redeploy.
The runtime detects the crash and exposes the relevant logs and health information. Where supported, the affected strategy can be restarted without disrupting other strategies running in the same container. Your strategy code is still responsible for safe error handling, duplicate-order protection and risk controls. See observability for the logs and health surface.
Gate v4 signs with HMAC-SHA512 (not SHA256) and the signature string concatenates with literal \n: Method + "\n" + URL_Path + "\n" + QueryString + "\n" + HexEncode(SHA512(Body)) + "\n" + Timestamp. The output is hex, not base64. The three required headers are KEY, Timestamp, SIGN; no passphrase (that is OKX). The body hash must be hex SHA512 of the raw request body, with empty body hashing to the SHA512 of an empty string. See the Operational notes section above for the full guidance.
Yes, futures only. Futures TestNet runs at https://fx-api-testnet.gateio.ws/api/v4 (REST) and wss://fx-ws-testnet.gateio.ws/v4/ws/{usdt,btc} (WebSocket). You must generate separate TestNet API keys; production keys do not authenticate against TestNet. Spot has no public sandbox; test spot strategies with Freqtrade dry_run or CCXT in record-and-replay mode before going live.
No. Gate.io blocks US persons and US residents. TradingHost cannot route orders to Gate.io from a US account; the restriction is at the venue. You also cannot use Gate from mainland China; Gate exited that market after the September 24, 2021 People's Bank of China ban. Other restricted jurisdictions include Canada, Singapore and UK.
TradingHost runs in the EU and US-East regions. Pick the region closest to the matching engine your strategy depends on. See the regions page for routing and proximity details.
No. TradingHost is focused on production runtime and deployment. Backtesting belongs in your research stack, framework or AlgoBuilder.