Skip to Content
HTTP APILeverage and margin

Leverage and 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.

Command
curl 'http://127.0.0.1:48180/v1/account/leverage?connection_id=12&instrument=binance:futures:BTCUSDT' \
  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN"
GET
/account/leverage

The leverage the terminal has loaded for the instrument. It is loaded when the instrument is chosen in the window or when the leverage is set with POST. Before that the answer is 409 not_active.

Authorization

bearerToken account:read
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: account:read

Query Parameters

connection_id*integer

The connection of the instrument.

Formatint64
instrument*string

Instrument address, exchange:market:symbol.

Response Body

Leverage of the instrument.

application/json
  1. response
connection_id*integer
Formatint64
instrument*string
leverage*integer
max_leverage*integer
mode*string

The leverage mode of the terminal, not of the exchange.

Value in"manual""max""smart"
margin_mode*MarginMode
Value in"cross""isolated"
Example Request
curl 'http://127.0.0.1:48180/v1/account/leverage?connection_id=12&instrument=binance:futures:BTCUSDT' \  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN"
Example Response
{  "connection_id": 12,  "instrument": "binance:futures:BTCUSDT",  "leverage": 10,  "max_leverage": 125,  "mode": "manual",  "margin_mode": "cross"}