All Position Change Events

Topic: /contract/positionAll

Position Changes Caused Operations
//Position Changes Caused Operations
{
  "type": "message",
  "userId": "5c32d69203aa676ce4b543c7", // Deprecated, will detele later
  "channelType": "private",
  "topic": "/contract/position:XBTUSDM",
  "subject": "position.change",
  "data": {
    "realisedGrossPnl": 0e-8, //Accumulated realised profit and loss
    "symbol": "XBTUSDM", //Symbol
    "crossMode": false, //Cross mode or not
    "liquidationPrice": 1000000.0, //Liquidation price
    "posLoss": 0e-8, //Manually added margin amount
    "avgEntryPrice": 7508.22, //Average entry price
    "unrealisedPnl": -0.00014735, //Unrealised profit and loss
    "markPrice": 7947.83, //Mark price
    "posMargin": 0.00266779, //Position margin
    "autoDeposit": false, //Auto deposit margin or not
    "riskLimit": 100000, //Risk limit
    "unrealisedCost": 0.00266375, //Unrealised value
    "posComm": 0.00000392, //Bankruptcy cost
    "posMaint": 0.00001724, //Maintenance margin
    "posCost": 0.00266375, //Position value
    "maintMarginReq": 0.005, //Maintenance margin rate
    "bankruptPrice": 1000000.0, //Bankruptcy price
    "realisedCost": 0.00000271, //Currently accumulated realised position value
    "markValue": 0.0025164, //Mark value
    "posInit": 0.00266375, //Position margin
    "realisedPnl": -0.00000253, //Realised profit and losts
    "maintMargin": 0.00252044, //Position margin
    "realLeverage": 1.06, //Leverage of the order
    "changeReason": "positionChange", //changeReason:marginChange、positionChange、liquidation、autoAppendMarginStatusChange、adl
    "currentCost": 0.00266375, //Current position value
    "openingTimestamp": 1558433191000, //Open time
    "currentQty": -20, //Current position
    "delevPercentage": 0.52, //ADL ranking percentile
    "currentComm": 0.00000271, //Current commission
    "realisedGrossCost": 0e-8, //Accumulated reliased gross profit value
    "isOpen": true, //Opened position or not
    "posCross": 1.2e-7, //Manually added margin
    "currentTimestamp": 1558506060394, //Current timestamp
    "unrealisedRoePcnt": -0.0553, //Rate of return on investment
    "unrealisedPnlPcnt": -0.0553, //Position profit and loss ratio
    "settleCurrency": "XBT" //Currency used to clear and settle the trades
  }
}
  • changeReason Descriptions:
    • “marginChange”: margin change;
    • “positionChange”: position change;
    • “liquidation”: liquidation;
    • “autoAppendMarginStatusChange”: auto-deposit-status change;
    • “adl”: adl;
Position Changes Caused by Mark Price
//Position Changes Caused by Mark Price
{
  "userId": "5cd3f1a7b7ebc19ae9558591", // Deprecated, will detele later
  "topic": "/contract/position:XBTUSDM",
  "subject": "position.change",
  "data": {
    "markPrice": 7947.83, //Mark price
    "markValue": 0.0025164, //Mark value
    "maintMargin": 0.00252044, //Position margin
    "realLeverage": 10.06, //Leverage of the order
    "unrealisedPnl": -0.00014735, //Unrealised profit and lost
    "unrealisedRoePcnt": -0.0553, //Rate of return on investment
    "unrealisedPnlPcnt": -0.0553, //Position profit and loss ratio
    "delevPercentage": 0.52, //ADL ranking percentile
    "currentTimestamp": 1558087175068, //Current timestamp
    "settleCurrency": "XBT" //Currency used to clear and settle the trades
  }
}
Funding Settlement
//Funding Settlement
{
  "userId": "xbc453tg732eba53a88ggyt8c", // Deprecated, will detele later
  "topic": "/contract/position:XBTUSDM",
  "subject": "position.settlement",
  "data": {
    "fundingTime": 1551770400000, //Funding time
    "qty": 100, //Position size
    "markPrice": 3610.85, //Settlement price
    "fundingRate": -0.002966, //Funding rate
    "fundingFee": -296, //Funding fees
    "ts": 1547697294838004923, //Current time (nanosecond)
    "settleCurrency": "XBT" //Currency used to clear and settle the trades
  }
}
Adjustment Result of Risk Limit Level
// Adjustment Result of Risk Limit Level
{
  "userId": "xbc453tg732eba53a88ggyt8c",
  "topic": "/contract/position:ADAUSDTM",
  "subject": "position.adjustRiskLimit",
  "data": {
    "success": true, // Successful or not
    "riskLimitLevel": 1, // Current risk limit level
    "msg": "" // Failure reason
  }
}
  • msg failure reasons:
    • the value of the holding position exceeds the limit amount of the risk limit level;
    • insufficient balance to increase the margin.