Gate.io Guide
Connect TradingView to Gate.io (Spot, Margin, and Futures) using TradeAdapter’s direct API integration. This guide covers strategy-based alerts with the Message Generator.
Video walkthrough #
Gate.io + TradingView setup
1 — Create Gate.io API keys #
Gate.io supports APIv2 (spot only) and APIv4 (spot, margin, and futures). For TradeAdapter use APIv4 with Read and Write permission so you can place orders.
-
Open API Management
Log in to Gate.io, open your profile menu and click API Management.
-
Create API key
Click Create API Key. For APIv4: set a name, optionally bind IP (unbound keys are valid 90 days), choose API v4 Key, select account type (Classic / Margin / Testnet), set Read and Write, and submit. Confirm with fund password and 2FA.
-
Save your credentials
Copy and store your API Key and Secret. You will paste them into the alert message as
broker_api_keyandbroker_api_secret.
2 — Select the Gate.io symbol in TradingView #
Open TradingView and search for the symbol using the Gate.io prefix. Match the symbol to the market you will use in your message: Spot, Margin, or Futures.
Important
The {{ticker}} placeholder sends this exact symbol to Gate.io. The symbol must exist in the chosen market and match the supported symbols. Check the symbol lists for min size and precision.
3 — Add your strategy #
This guide covers strategy alerts only. Load your Pine Script strategy onto the chart so it generates the trading signals.
Open Pine Editor, paste your strategy code, and click “Add to chart”. Open the Strategy Tester tab to confirm backtest results and that orders are generated.
Not sure if you have a strategy or an indicator? See Indicator vs Strategy.
4 — Configure order size #
Gate.io enforces symbol-specific rules (min order size, precision). Configure your strategy’s position size so that {{strategy.order.contracts}} meets the symbol’s minimum and step. For Limit orders, ensure {{strategy.order.price}} respects the price step.
Gate.io Spot •
Gate.io Margin •
Gate.io Futures — check min size and precision per symbol.
5 — Create the TradingView alert #
Press Alt + A (or the alarm clock icon) to create a new alert on your strategy.
Strategy → one alert
Under Condition, select your strategy and set trigger to “Order fills only”. TradingView fills action, size, and price via {{strategy.order.action}}, {{strategy.order.contracts}}, and {{strategy.order.price}}.
Required: Webhook URL + Message
In Notifications, enable Webhook URL and paste your personal webhook from your TradeAdapter profile. Paste the JSON message (below) in the Message field. You can build it with the Gate.io Message Generator.
Alert message (Strategy) #
Use this template for strategy-based alerts. Replace the placeholder values with your API key and secret. Set account_type to Spot, Margin, Cross_margin, or Unified. Set order_market to Spot or Futures. Keep the TradingView placeholders as-is.
{
"broker_api_key": "PUT YOUR GATE.IO API KEY HERE",
"broker_api_secret": "PUT YOUR GATE.IO SECRET HERE",
"account_type": "Spot",
"real_order": "No",
"order_market": "Spot",
"order_type": "Market",
"exchange": "GATEIO",
"ticker": "{{ticker}}",
"time": "{{timenow}}",
"order_contracts": "{{strategy.order.contracts}}",
"order_action": "{{strategy.order.action}}",
"order_price": "{{strategy.order.price}}"
}
Message fields explained #
| Field | Description |
|---|---|
broker_api_key |
Your Gate.io API Key from the API creation step. |
broker_api_secret |
Your Gate.io Secret. Store it securely and never share it. |
account_type |
"Spot", "Margin", "Cross_margin", or "Unified". Must match the account you trade on. |
real_order |
"Yes" sends real orders to Gate.io. "No" sends test orders via TradeAdapter only. |
order_market |
"Spot" or "Futures". Must match the symbol’s market. |
order_type |
"Market" or "Limit". For Limit orders, order_price is used as the limit price. |
exchange |
Must be "GATEIO" so TradeAdapter routes the order to Gate.io. |
ticker |
The TradingView symbol from {{ticker}} (e.g. GATEIO:BTC_USDT). |
order_contracts |
Position size from your strategy ({{strategy.order.contracts}}). |
order_action |
"BUY" or "SELL". Use {{strategy.order.action}} for strategies. |
order_price |
Price from the strategy ({{strategy.order.price}}), used for Limit orders. |
6 — Execute & monitor #
-
Start with test orders
Set
"real_order": "No"and trigger a few alerts. Check MyTrades to see how TradeAdapter interprets your signals. -
Verify on Gate.io
When you set
"real_order": "Yes", monitor your Gate.io account to confirm orders execute as expected. -
Recreate alerts after changes
If you change strategy parameters or the message, delete and recreate the TradingView alert so the new values are applied.
Important notes #
API security — Never share your Secret. Use a key with trading permission only. Optionally bind IP in Gate.io API settings to restrict access.
Respect symbol specs — Check Spot, Margin, and Futures symbol lists for min size and precision; test with small orders before scaling.
Recreate alerts after changes — If you change strategy parameters or message fields, delete and recreate the TradingView alert.
All setup guides