Set the margin mode
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/account/margin-mode' \
-H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"connection_id": 12,
"instrument": "binance:futures:BTCUSDT",
"margin_mode": "isolated"
}'The exchange rejects a change while a position is open. The accepted answer does not show that.
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.
margin_mode*MarginMode"cross""isolated"The terminal accepted the command. key is null.
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/account/margin-mode' \ -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN" \ -H 'Content-Type: application/json' \ -d '{ "connection_id": 12, "instrument": "binance:futures:BTCUSDT", "margin_mode": "isolated"}'{ "accepted": true, "operation_id": "173029440000000010", "key": null, "connection_id": 12, "instrument": "binance:futures:BTCUSDT"}Set the leverage POST
Sets a fixed leverage or a leverage mode. Pass exactly one of `leverage` and `mode`. The applied value shows in `GET` after the exchange answers.
All windows GET
All windows with their tabs, stacks and charts. An empty stack has `instrument` and `connection_id` of `null`. `position` is `null` for a stack hidden in a group of stacks.