TradingView to KuCoin: automate alerts on KuCoin Futures and spot
With AlgoVesta, a TradingView alert opens an order on your KuCoin account within seconds. KuCoin Futures positions use cross margin and get stop-loss and take-profit stop orders; spot buys are sent by the amount to spend, then protected by two stop orders. The API key needs General and Trade permissions and a passphrase.
How it works
Set a name and a passphrase, tick General and Trade, and keep the key away from withdrawals.
Enter all three in the AlgoVesta dashboard; they are encrypted before storage.
A bot targets one market. Futures uses cross margin and contracts; spot buys by cost.
Add your AlgoVesta webhook URL to the TradingView alert and send a test signal.
KuCoin Futures in practice
KuCoin Futures is a separate product from KuCoin spot, with its own contract sizes. AlgoVesta sets the position to cross margin, converts your margin and leverage into contracts and rounds to the closest size KuCoin accepts, within the same 20% tolerance used on every exchange. Stop-loss and take-profit follow as reduce-only stop orders and are checked on KuCoin.
If you trade KuCoin Futures from several strategies, each bot keeps its own record of what it opened; a close from one strategy does not close quantity opened by another.
KuCoin spot buys by cost
KuCoin's market buy on spot is reliable when it is sent as an amount to spend rather than a coin quantity; a quantity-based market buy can be accepted and then fill nothing. AlgoVesta therefore sends spot market buys by cost. The stop-loss and take-profit are then two stop orders on the coins you received, one below and one above the entry.
The passphrase
Like OKX and Bitget, KuCoin adds a passphrase to every API key. It is chosen when the key is created and is needed to sign every request, so AlgoVesta asks for it together with the key and secret and stores it encrypted.
The alert message
Paste this into the alert's message box. The two plot values come from your indicator; leverage is ignored on spot.
{
"symbol": "{{ticker}}",
"action": "buy",
"price": "{{close}}",
"stop_loss": "{{plot_0}}",
"take_profit": "{{plot_1}}",
"leverage": 10
}
For a Pine strategy, use the strategy template so exits and reversals work. Do not send only {{strategy.order.action}}: on an exit it reads "sell" and would open a short instead of closing. The market_position fields tell AlgoVesta when the strategy is flat.
{
"symbol": "{{ticker}}",
"action": "{{strategy.order.action}}",
"market_position": "{{strategy.market_position}}",
"prev_market_position": "{{strategy.prev_market_position}}",
"position_size": "{{strategy.position_size}}",
"price": "{{close}}"
}
TradingView only shows the Webhook URL box when two-factor authentication is on in your TradingView account. TradingView cannot send custom headers, so AlgoVesta verifies the source from TradingView's own server addresses and auto-trades only alerts it can verify.
Connect your KuCoin API key
Create the key in KuCoin with these permissions: General + Trade. Withdrawal and transfer stay disabled, because AlgoVesta never needs them: it can place and close orders, but it cannot move funds out of your account. KuCoin keys also have a passphrase that you choose when you create the key. Enter it in AlgoVesta together with the key and secret; it is encrypted the same way.
If you restrict the key to IP addresses, the AlgoVesta connection wizard shows the two server addresses to add. The full click-by-click guide, with what each KuCoin screen looks like, is in the help center.
How to connect KuCoin to AlgoVesta →
Rules that apply to every order
- A stop-loss on every order: from the signal, or from your own percentage or distance. No stop-loss source, no order.
- A daily-loss limit that pauses new entries until the next UTC day.
- Maximum open positions and maximum trades per day per bot.
- A panic button that closes what AlgoVesta opened and leaves your own positions alone.
On crypto exchanges an order opens in about 4.1 seconds on average, from the signal arriving to a filled order with its protection attached, measured across AlgoVesta's own executions.
KuCoin questions
The most common questions before you decide — if you still have doubts, start here.
Try TradingView alerts on KuCoin in paper mode first
Every bot can start on a $5,000 virtual balance, so you see the fills before a real order is sent. 7-day free trial, no credit card required.
Start Free Trial