Place a trigger order
Build your request
Change the values and the command follows. The token is never typed here: the command reads it from the SPECTRE_LOCAL_API_TOKEN environment variable. Run it in your own terminal.
curl -X POST 'http://127.0.0.1:48180/v1/orders/trigger' \
-H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"connection_id": 12,
"instrument": "binance:futures:BTCUSDT",
"kind": "stop_loss",
"trigger_price": "66000",
"client_key": "sl-42"
}'stop_loss and take_profit are placed on the open position and take only trigger_price. stop needs its own side and notional. Without rule a buy stop triggers above the market and a sell stop below.
bearerToken trading:writeAuthorizationBearer <token>The Local API token: spt_ and 64 hex characters. Copy it from Settings App → General → Local API. It is accepted only in the Authorization header. The names listed with an operation are the scopes it requires. The token of the terminal carries all of them.
Scope: trading:write
application/json- body
connection_id*integerint64instrument*stringInstrument address, exchange:market:symbol.
kind*TriggerKind"stop_loss""take_profit""stop"trigger_price*stringDecimal string.
side?stringOnly for stop.
"buy""sell"notional?stringOnly for stop: the amount in the quote currency.
rule?TriggerRule"price_above_or_equal""price_below_or_equal"client_key?stringIdempotency key, as in POST /orders.
The terminal accepted the command.
application/json- response
The answer of every trading, trigger and leverage command.
accepted*booleanAccepted by the terminal, not by the exchange.
operation_id*stringThe id of the operation in the trading operations log of the terminal. The key of a placed order is t- and this id.
key*|The key of the placed order, t-…, or of the placed trigger: sl_…, tp_… or stop_…. null for cancels, amendments and leverage.
connection_id*integerint64instrument*stringcurl -X POST 'http://127.0.0.1:48180/v1/orders/trigger' \ -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN" \ -H 'Content-Type: application/json' \ -d '{ "connection_id": 12, "instrument": "binance:futures:BTCUSDT", "kind": "stop_loss", "trigger_price": "66000", "client_key": "sl-42"}'{ "accepted": true, "operation_id": "173029440000000005", "key": "sl_17302944001230005", "connection_id": 12, "instrument": "binance:futures:BTCUSDT"}Close a position POST
Closes the position of the instrument the way the window does. On futures it sends a market order for the size of the position. On spot it cancels all orders and closes the position in one command.
Cancel all trigger orders POST
Cancels the trigger orders of one instrument. Ordinary orders are not touched. Cancel those with `POST /orders/cancel-all`.