Skip to Content
HTTP APITrigger orders

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.

Command
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"
}'
POST
/orders/trigger

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.

Authorization

bearerToken trading:write
headerAuthorizationBearer <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

Request Body

application/json
  1. body
connection_id*integer
Formatint64
instrument*string

Instrument address, exchange:market:symbol.

kind*TriggerKind
Value in"stop_loss""take_profit""stop"
trigger_price*string

Decimal string.

side?string

Only for stop.

Value in"buy""sell"
notional?string

Only for stop: the amount in the quote currency.

rule?TriggerRule
Value in"price_above_or_equal""price_below_or_equal"
client_key?string

Idempotency key, as in POST /orders.

Response Body

The terminal accepted the command.

application/json
  1. response

The answer of every trading, trigger and leverage command.

accepted*boolean

Accepted by the terminal, not by the exchange.

operation_id*string

The 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*integer
Formatint64
instrument*string
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"}'
Example Response
{  "accepted": true,  "operation_id": "173029440000000005",  "key": "sl_17302944001230005",  "connection_id": 12,  "instrument": "binance:futures:BTCUSDT"}