Trading API
Order data stream
Everything needed to size and round an order on one instrument: price and quantity steps, fees, leverage, your account settings and live buying power.
WSS
/
api
/
v1
/
trading
/
order
/
data
/
stream
The order data stream tells you what the exchange will accept on one instrument of one account. Connect to
wss://public-api.charting.com/api/v1/trading/order/data/stream with accountId, exchange, symbol, and connectorCode when the account has more than one connector. Sign the handshake like a GET (see Sign every request).
Frames
The first frame is asnapshot with:
instrumentInfo: price and quantity bounds and steps,quantityUnit, maker and taker fees, leverage bounds, slippage and trailing stop bounds.accountSettings: your settings for the instrument, such aspositionModeand leverage.riskLimits: the instrument’s risk limits for your account.userRebateRate: your cashback rate on this account. It’s fixed for the life of the stream.
| Frame | Sent when |
|---|---|
buyingPower | Buying power or total equity changed. Buying power isn’t in the snapshot: the first buyingPower frame usually follows right after it. |
instrumentInfo, accountSettings, riskLimits | That part changed. The frame is always complete: replace the part you hold. |
currencyRates | Conversion rates between assets changed. |
hmrLeverage | Exness only: the instrument’s higher-margin window changed. |
error | The stream ended. The socket closes after it. |
buyingPower and currencyRates can change many times a second. Pass throttlingDelay, in milliseconds up to 60000, to get at most one of each per interval, always the newest.
Before sending an order
- Round the price to
instrumentInfo.price.step. - Keep the quantity between
instrumentInfo.quantity.minandmax, in steps ofquantity.step, counted inquantityUnit. - Send
positionModefromaccountSettingswhen the connector needs it.
Messages
{
"type": "snapshot",
"seq": 1,
"accountId": "4b8e2f6a-91c3-4d57-a0e8-3f1c7b9d2e45",
"connectorCode": "binance_usdm",
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"instrumentInfo": {
"baseAsset": "BTC",
"quoteAsset": "USDT",
"quantityUnit": "baseAsset",
"marketType": "perpetual",
"contractType": "linear",
"price": {
"min": "0.1",
"max": "1000000",
"step": "0.1"
},
"quantity": {
"min": "0.001",
"max": "1000",
"step": "0.001"
}
},
"accountSettings": {
"positionMode": "oneWay",
"marginMode": "cross",
"leverageBuy": "10",
"leverageSell": "10"
}
}{
"type": "buyingPower",
"seq": 2,
"buy": {
"asset": "USDT",
"margin": "12500"
},
"sell": {
"asset": "USDT",
"margin": "12500"
},
"totalEquity": "12650.40"
}No examples foundNo examples found{
"type": "<string>",
"seq": 123,
"riskLimits": {
"initialMarginRate": "<string>",
"maintenanceMarginRate": "<string>",
"positionLimit": "<string>"
}
}{
"type": "currencyRates",
"seq": 3,
"rates": [
{
"baseAsset": "USDT",
"quoteAsset": "USD",
"rate": "0.9998"
}
]
}{
"type": "<string>",
"seq": 123,
"period": {
"start": "<string>",
"end": "<string>",
"periodId": "<string>",
"effectiveLeverage": "<string>"
}
}{
"type": "error",
"error": {
"code": "rate_limited",
"message": "quota exceeded"
}
}X-API-KEY
type:httpApiKey
Your API key.
X-API-TIMESTAMP
type:httpApiKey
Time of the upgrade request in Unix milliseconds.
X-API-SIGNATURE
type:httpApiKey
Hex Ed25519 signature of timestamp + API key + receive window + raw query string.
method
type:string
GET
query
type:object
Order data snapshot
type:object
Buying power changed
type:object
Instrument rules changed
type:object
Account settings changed
type:object
Risk limits changed
type:object
Currency rates
type:object
Higher margin window changed
type:object
Exness: the higher-margin window of the instrument changed (a new or
moved window, the one in force ended, or the account leverage
changed). period absent means no window is known any more. A change
that moves the leverage also sends accountSettings.
Terminal error
type:object
The stream is over; the socket is closed after this frame.
Was this page helpful?
⌘I
Messages
{
"type": "snapshot",
"seq": 1,
"accountId": "4b8e2f6a-91c3-4d57-a0e8-3f1c7b9d2e45",
"connectorCode": "binance_usdm",
"instrument": {
"exchange": "CXBNCE",
"symbol": "BTC/USDT"
},
"instrumentInfo": {
"baseAsset": "BTC",
"quoteAsset": "USDT",
"quantityUnit": "baseAsset",
"marketType": "perpetual",
"contractType": "linear",
"price": {
"min": "0.1",
"max": "1000000",
"step": "0.1"
},
"quantity": {
"min": "0.001",
"max": "1000",
"step": "0.001"
}
},
"accountSettings": {
"positionMode": "oneWay",
"marginMode": "cross",
"leverageBuy": "10",
"leverageSell": "10"
}
}{
"type": "buyingPower",
"seq": 2,
"buy": {
"asset": "USDT",
"margin": "12500"
},
"sell": {
"asset": "USDT",
"margin": "12500"
},
"totalEquity": "12650.40"
}No examples foundNo examples found{
"type": "<string>",
"seq": 123,
"riskLimits": {
"initialMarginRate": "<string>",
"maintenanceMarginRate": "<string>",
"positionLimit": "<string>"
}
}{
"type": "currencyRates",
"seq": 3,
"rates": [
{
"baseAsset": "USDT",
"quoteAsset": "USD",
"rate": "0.9998"
}
]
}{
"type": "<string>",
"seq": 123,
"period": {
"start": "<string>",
"end": "<string>",
"periodId": "<string>",
"effectiveLeverage": "<string>"
}
}{
"type": "error",
"error": {
"code": "rate_limited",
"message": "quota exceeded"
}
}