This nodejs project allows you to execute trades from Tradingview alerts on most crypto exchanges.
- copy
config.json.sample
toconfig.json
and fill in the required informationname
is the alias for the exchange (you can have multiple aliases/accounts on 1 exchange)exchange
is the exchangeid
used inccxt
librarykey
&secret
refer to the API keys you have to generate on each exchange
- mount this config file in your docker container, ideally using
docker-compose.yml
Tradingview Webhook URL
must be set to https://{your-hostname.tld}/trade
Read the following sections to understand how to fill the Message
field.
{
"account": "deribit_main",
"instrument": "BTC-PERPETUAL",
"orders": [
{ "t": "market_buy", "a": 10 },
{ "t": "limit_buy", "a": 10, "p": 35000 },
{ "t": "stop_market_sell", "a": 20, "p": 30000 }
]
}
This example will open a market position, place a limit buy order, and set a stop order.
Note: JSON must be valid in order to be executed. You can check format using JSONLint.
t
order typea
amount to buy or sellp
price at which to place orderu
upper price for a scaled orderl
lower price for a scaled ordern
number of orders for a scaled order
t | a | p | u | l | n |
---|---|---|---|---|---|
limit_buy | x | x | |||
limit_sell | x | x | |||
scaled_buy | x | x | x | x | |
scaled_sell | x | x | x | x | |
market_buy | x | ||||
market_sell | x | ||||
stop_market_buy | x | x | |||
stop_market_sell | x | x | |||
close_position |
curl -X POST -H "Content-Type: application/json" -d '{ "account": "first_account", "instrument": "BTC-PERPETUAL", "orders": [{ "t": "debug", "a": 10, "p": 10 }] }' http://localhost:3000/trade
POST /trade
to place trades from tradingviewGET /exchanges
to list supported exhanges, useful to find accxt id
GET /exchanges/:exchange
to list available instruments (symbols) for a specific exchange
It depends on the exchange. Example:
- deribit: it's fiat on
BTC-PERPETUAL
- bitfinex: it's asset on
BTC/USD
Refere to exchange or ccxt documentation.