Private Data
All private data updates are realtime. Multiple topics and multiple accounts can be subscribed to within a single connection.
A default subscribed trading account can be pre-specified by using this endpoint.
/trading-api/v1/private-data?tradingAccountId={id}
Otherwise controlled by parameters in the subscription message listed below
/trading-api/v1/private-data
Please note that authentication is mandatory
Operations
SEND/trading-api/v1/private-data
Subscribe
Multiple subscriptions could be opened within the same websocket.
The topics & accounts to be subscribed are controlled by the parameters in the subscription message listed below.
After subscribing, the server sends :
- an acknowledgement
- then an initial snapshot
- followed by incremental updates.
Accepts the following message:
Let you subscribe to a given topic
Examples
{
"method": "subscribe",
"id": "1611082473000",
"jsonrpc": "2.0",
"type": "command",
"params": {
"topic": "orders",
"tradingAccountId": "1111"
}
}
This example has been generated automatically.
RECEIVE/trading-api/v1/private-data
In case of invalid subscription message, an error rejection would be sent.
This also includes trading account access rejections
Sends the following message:
Explain why the topic could not be subscribed
Examples
{
"id": "1611082473000",
"jsonrpc": "2.0",
"error": {
"code": "-32602",
"errorCode": "29013",
"errorCodeName": "'abcde' is not a valid topic"
}
}
This example has been generated automatically.
SEND/trading-api/v1/private-data
Keepalive
In case nothing is subscribed to, keep the websocket connection alive.
Accepts the following message:
Examples
{
"method": "keepalivePing",
"params": {},
"id": "1611082473000",
"jsonrpc": "2.0",
"type": "command"
}
This example has been generated automatically.
RECEIVE/trading-api/v1/private-data
Acknowledgement returned by the server in response to a keepalive-ping.
Sends the following message:
Examples
{
"id": "1611082473000",
"jsonrpc": "2.0",
"result": {
"responseCodeName": "OK",
"responseCode": 200,
"message": "Keep alive pong"
}
}
This example has been generated automatically.
SEND/trading-api/v1/private-data
Unsubscribe
Let you unsubscribe a specific topic while keeping your websocket opened.
Accepts the following message:
Let you unsubscribe from an opened subscription
Examples
{
"method": "unsubscribe",
"id": "1611082473000",
"jsonrpc": "2.0",
"type": "command",
"params": {
"subscriptionId": "1611082473000"
}
}
This example has been generated automatically.
RECEIVE/trading-api/v1/private-data
After unsubscribing, the server sends an acknowledgement.
Sends the following message:
Confirm the subscription was closed
Examples
{
"id": "1611082473000",
"jsonrpc": "2.0",
"result": {
"responseCodeName": "OK",
"responseCode": "200",
"message": "Successfully unsubscribed"
}
}
This example has been generated automatically.
RECEIVE/trading-api/v1/private-data
In case of invalid unsubscription message, an error rejection would be sent.
Sends the following message:
Explain why the topic could not be unsubscribed
Examples
{
"id": "1611082473000",
"jsonrpc": "2.0",
"error": {
"code": "-32602",
"errorCode": "29013",
"errorCodeName": "'abcde' is not a valid topic"
}
}
This example has been generated automatically.
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed order data
objectExamples
{"type": "snapshot","dataType": "V1TAOrder","data": [{"handle": null,"orderId": "392883006043848705","symbol": "BTCUSD","price": "66858.2000","averageFillPrice": "66858.2000","stopPrice": null,"margin": false,"quantity": "2.00000000","quantityFilled": "2.00000000","quoteAmount": "23000.0000","baseFee": "0.00000000","quoteFee": "0.0005","side": "BUY","borrowedQuantity": "0.0010","isLiquidation": false,"type": "LMT","timeInForce": "GTC","status": "CLOSED","statusReason": "Executed","statusReasonCode": 6002,"createdAtDatetime": "2021-12-30T07:36:35.918Z","createdAtTimestamp": "1640849795918","publishedAtTimestamp": "1640849795920"}]}This example has been generated automatically.
- #3Update
Incremental update to the subscribed order data
objectExamples
{"type": "update","dataType": "V1TAOrder","data": {"handle": null,"orderId": "392883006043848705","symbol": "BTCUSD","price": "66858.2000","averageFillPrice": "66858.2000","stopPrice": null,"margin": false,"quantity": "2.00000000","quantityFilled": "2.00000000","quoteAmount": "23000.0000","baseFee": "0.00000000","quoteFee": "0.0005","side": "BUY","borrowedQuantity": "0.0010","isLiquidation": false,"type": "LMT","timeInForce": "GTC","status": "CLOSED","statusReason": "Executed","statusReasonCode": 6002,"createdAtDatetime": "2021-12-30T07:36:35.918Z","createdAtTimestamp": "1640849795918","publishedAtTimestamp": "1640849795920"}}This example has been generated automatically.
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed trade data
objectExamples
{"type": "snapshot","dataType": "V1TATrade","data": [{"tradeId": "100014000000000118","orderId": "392883006043848705","handle": "123456","symbol": "BTCUSD","price": "66858.2000","quantity": "2.00000000","quoteAmount": "23000.0000","baseFee": "0.00000000","quoteFee": "66.8582","side": "BUY","isTaker": false,"tradeRebateAmount": "3.0000","tradeRebateAssetSymbol": "USDC","otcMatchId": "15","otcTradeId": "200014000000000118","clientOtcTradeId": "300014000000000118","createdAtDatetime": "2021-12-30T07:36:35.918Z","createdAtTimestamp": "1640849795918","publishedAtTimestamp": "1640849795920"}]}This example has been generated automatically.
- #3Update
Incremental update to the subscribed trade data
objectExamples
{"type": "update","dataType": "V1TATrade","data": {"tradeId": "100014000000000118","orderId": "392883006043848705","handle": "123456","symbol": "BTCUSD","price": "66858.2000","quantity": "2.00000000","quoteAmount": "23000.0000","baseFee": "0.00000000","quoteFee": "66.8582","side": "BUY","isTaker": false,"tradeRebateAmount": "3.0000","tradeRebateAssetSymbol": "USDC","otcMatchId": "15","otcTradeId": "200014000000000118","clientOtcTradeId": "300014000000000118","createdAtDatetime": "2021-12-30T07:36:35.918Z","createdAtTimestamp": "1640849795918","publishedAtTimestamp": "1640849795920"}}This example has been generated automatically.
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed spot accounts data
objectExamples
{"type": "snapshot","dataType": "V1TASpotAccount","data": [{}]}This example has been generated automatically.
- #3Update
Incremental update to the subscribed spot accounts data
objectExamples
{"type": "update","dataType": "V1TASpotAccount","data": {}}This example has been generated automatically.
RECEIVE/trading-api/v1/private-data
Receive Asset Accounts
V1TAAssetAccount provides a more granular view of the assets in your trading account compared to V1TASpotAccount.
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed asset accounts data
objectExamples
{"type": "snapshot","dataType": "V1TAAssetAccount","data": [{"tradingAccountId": "1111","assetId": "1","assetSymbol": "BTC","availableQuantity": "4.00000000","borrowedQuantity": "20.00000000","lockedQuantity": "0.00000000","loanedQuantity": "10.00000000","updatedAtDatetime": "2021-12-30T07:36:35.918Z","updatedAtTimestamp": "1640849795918","publishedAtTimestamp": "1640849795920"}]}This example has been generated automatically.
- #3Update
Incremental update to the subscribed asset accounts data
objectExamples
{"type": "update","dataType": "V1TAAssetAccount","data": {"tradingAccountId": "1111","assetId": "1","assetSymbol": "BTC","availableQuantity": "4.00000000","borrowedQuantity": "20.00000000","lockedQuantity": "0.00000000","loanedQuantity": "10.00000000","updatedAtDatetime": "2021-12-30T07:36:35.918Z","updatedAtTimestamp": "1640849795918","publishedAtTimestamp": "1640849795920"}}This example has been generated automatically.
RECEIVE/trading-api/v1/private-data
Receive Trading Accounts
- Provides a summary of the total borrowed and total collateral values on the specific trading account id. totalBorrowedQuantity and totalCollateralQuantity do not represent the absolute quantity of the borrowed assets and are notional values represented in the reference asset.
- Snapshot contains a list with a single entry corresponding to the trading account id specified in the tradingAccountId query parameter when opening the WebSocket connection.
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed trading accounts data
objectExamples
{"type": "snapshot","dataType": "V1TATradingAccount","data": [{"tradingAccountId": "1111","totalBorrowedQuantity": "12000.0000","totalCollateralQuantity": "13000.0000","totalBorrowedUSD": "12000.0000","totalCollateralUSD": "13000.0000","referenceAssetSymbol": "USD","initialMarginUSD": "900000.0000","warningMarginUSD": "700000.0000","liquidationMarginUSD": "600000.0000","fullLiquidationMarginUSD": "500000.0000","endCustomerId": "PrimeBroker","defaultedMarginUSD": "300000.0000","riskLimitUSD": "1000000.0000","totalLiabilitiesUSD": "13000.0000","maxInitialLeverage": "3","isPrimaryAccount": true,"isBorrowing": true,"isLending": false,"isDefaulted": false,"takerFee": null,"makerFee": null,"liquidityAddonUSD": "100.0000","marketRiskUSD": "200.0000","marginProfile": {"initialMarketRiskMultiplierPct": "200.00","warningMarketRiskMultiplierPct": "150.00","liquidationMarketRiskMultiplierPct": "100.00","fullLiquidationMarketRiskMultiplierPct": "75.00","defaultedMarketRiskMultiplierPct": "50.00"},"updatedAtDatetime": "2021-12-30T07:36:35.918Z","updatedAtTimestamp": "1640849795918","publishedAtTimestamp": "1640849795920"}]}This example has been generated automatically.
- #3Update
Incremental update to the subscribed trading accounts data
objectExamples
{"type": "update","dataType": "V1TATradingAccount","data": {"tradingAccountId": "1111","totalBorrowedQuantity": "12000.0000","totalCollateralQuantity": "13000.0000","totalBorrowedUSD": "12000.0000","totalCollateralUSD": "13000.0000","referenceAssetSymbol": "USD","initialMarginUSD": "900000.0000","warningMarginUSD": "700000.0000","liquidationMarginUSD": "600000.0000","fullLiquidationMarginUSD": "500000.0000","endCustomerId": "PrimeBroker","defaultedMarginUSD": "300000.0000","riskLimitUSD": "1000000.0000","totalLiabilitiesUSD": "13000.0000","maxInitialLeverage": "3","isPrimaryAccount": true,"isBorrowing": true,"isLending": false,"isDefaulted": false,"takerFee": null,"makerFee": null,"liquidityAddonUSD": "100.0000","marketRiskUSD": "200.0000","marginProfile": {"initialMarketRiskMultiplierPct": "200.00","warningMarketRiskMultiplierPct": "150.00","liquidationMarketRiskMultiplierPct": "100.00","fullLiquidationMarketRiskMultiplierPct": "75.00","defaultedMarketRiskMultiplierPct": "50.00"},"updatedAtDatetime": "2021-12-30T07:36:35.918Z","updatedAtTimestamp": "1640849795918","publishedAtTimestamp": "1640849795920"}}This example has been generated automatically.
RECEIVE/trading-api/v1/private-dataDeprecated
Receive Derivatives Positions
Topic derivativesPosition is being replaced by derivativesPositionV2.
- Provide a detail view of the derivative position of each market.
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed derivatives positions data
objectExamples
{"type": "snapshot","dataType": "V1TAPerpetualPosition","data": [{"tradingAccountId": "111234567890","symbol": "BTC-USDC-PERP","side": "BUY","quantity": "1.00000000","notional": "30000.0000","entryNotional": "30000.0000","mtmPnl": "110.0000","reportedMtmPnl": "120.0000","reportedFundingPnl": "130.0000","realizedPnl": "140.0000","createdAtDatetime": "2020-01-01T00:00:00.000Z","createdAtTimestamp": "1577836800000","updatedAtDatetime": "2020-01-02T00:00:00.000Z","updatedAtTimestamp": "1577923200000","publishedAtTimestamp": "1577923300000"}]}This example has been generated automatically.
- #3Update
Incremental update to the subscribed derivatives positions data
objectExamples
{"type": "update","dataType": "V1TAPerpetualPosition","data": {"tradingAccountId": "111234567890","symbol": "BTC-USDC-PERP","side": "BUY","quantity": "1.00000000","notional": "30000.0000","entryNotional": "30000.0000","mtmPnl": "110.0000","reportedMtmPnl": "120.0000","reportedFundingPnl": "130.0000","realizedPnl": "140.0000","createdAtDatetime": "2020-01-01T00:00:00.000Z","createdAtTimestamp": "1577836800000","updatedAtDatetime": "2020-01-02T00:00:00.000Z","updatedAtTimestamp": "1577923200000","publishedAtTimestamp": "1577923300000"}}This example has been generated automatically.
RECEIVE/trading-api/v1/private-data
Receive Derivatives Positions (V2)
Provide a detail view of the derivative position of each market.
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed derivatives positions (V2) data
objectExamples
{"type": "snapshot","dataType": "V1TADerivativesPosition","data": [{"tradingAccountId": "111234567890","symbol": "BTC-USDC-PERP","side": "BUY","quantity": "1.00000000","notional": "30000.0000","entryNotional": "30000.0000","mtmPnl": "110.0000","reportedMtmPnl": "120.0000","reportedFundingPnl": "130.0000","realizedPnl": "140.0000","settlementAssetSymbol": "USDC","eventType": "settlementUpdate","createdAtDatetime": "2020-01-01T00:00:00.000Z","createdAtTimestamp": "1577836800000","updatedAtDatetime": "2020-01-02T00:00:00.000Z","updatedAtTimestamp": "1577923200000","publishedAtTimestamp": "1577923300000"}]}This example has been generated automatically.
- #3Update
Incremental update to the subscribed derivatives positions (V2) data
objectExamples
{"type": "update","dataType": "V1TADerivativesPosition","data": {"tradingAccountId": "111234567890","symbol": "BTC-USDC-PERP","side": "BUY","quantity": "1.00000000","notional": "30000.0000","entryNotional": "30000.0000","mtmPnl": "110.0000","reportedMtmPnl": "120.0000","reportedFundingPnl": "130.0000","realizedPnl": "140.0000","settlementAssetSymbol": "USDC","eventType": "settlementUpdate","createdAtDatetime": "2020-01-01T00:00:00.000Z","createdAtTimestamp": "1577836800000","updatedAtDatetime": "2020-01-02T00:00:00.000Z","updatedAtTimestamp": "1577923200000","publishedAtTimestamp": "1577923300000"}}This example has been generated automatically.
RECEIVE/trading-api/v1/private-data
Receive AMM Instructions
- Provides updates of the active AMM instructions on the specific trading account id.
- This topic does not provide snapshot
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Update
Incremental update to the subscribed AMM instructions data
objectExamples
{"type": "update","dataType": "V1TAAmmInstruction","data": {"instructionId": "100","symbol": "BTCUSDC","baseFee": "1.00000000","quoteFee": "1.0000","status": "OPEN","statusReason": "Ok","statusReasonCode": "1001","createdAtDatetime": "2021-05-20T01:01:01.000Z","createdAtTimestamp": "1621490985000","baseCurrentQuantity": "0.00000000","baseInvestQuantity": "0.00000008","basePrice": "345.67000000","baseWithdrawQuantity": "0.00000010","currentValue": "0.0000","feeTierId": "1","finalValue": "0.0001","impermanentLoss": "0.0000","liquidity": "0.0001","lowerBound": "0.0013","price": "456.7800","quoteCurrentQuantity": "0.0000","quoteInvestQuantity": "0.0009","quotePrice": "1.0000","quoteWithdrawQuantity": "0.0011","lastDistributedPrice": null,"requestId": "197735387747975680","updatedAtDatetime": "2021-05-20T01:01:01.000Z","updatedAtTimestamp": "1621490985000","upperBound": "14000.0000"}}This example has been generated automatically.
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed MMP trigger data
objectExamples
{"type": "snapshot","dataType": "V1TAMMPTrigger","data": [{"mmpTriggerId": "100000000000000","tradingAccountId": "111000000000000","underlyingAssetSymbol": "BTC","triggeredBy": "Delta Limit","frozenTimeInSecond": "10","frozenStartTime": "1611082473000","frozenUntil": "1611082483000"}]}This example has been generated automatically.
- #3Update
Incremental update to the subscribed MMP trigger data
objectExamples
{"type": "update","dataType": "V1TAMMPTrigger","data": {"mmpTriggerId": "100000000000000","tradingAccountId": "111000000000000","underlyingAssetSymbol": "BTC","triggeredBy": "Delta Limit","frozenTimeInSecond": "10","frozenStartTime": "1611082473000","frozenUntil": "1611082483000"}}This example has been generated automatically.
Sends one of the following messages:
- #1Acknowledgment
Confirm the subscription was opened
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed trade data
objectExamples
{"type": "snapshot","dataType": "V1TAMMPConfigRequest","data": [{"requestId": "1","tradingAccountId": "111000000000000","assetSymbol": "BTC","windowTimeInSecond": "10","frozenTimeInSecond": "10","quantityLimit": "1000","deltaLimit": "500","status": "CLOSED","statusReason": "Ok","isReset": "false","createdAt": "1611082473000"}]}This example has been generated automatically.
- #3Update
Incremental update to the subscribed order data
objectExamples
{"type": "update","dataType": "V1TAMMPConfigRequest","data": {"requestId": "1","tradingAccountId": "111000000000000","assetSymbol": "BTC","windowTimeInSecond": "10","frozenTimeInSecond": "10","quantityLimit": "1000","deltaLimit": "500","status": "CLOSED","statusReason": "Ok","isReset": "false","createdAt": "1611082473000"}}This example has been generated automatically.