Position Change Events

Topic: /contract/position:{symbol}

Position Changes Caused Operations
//Position Changes Caused Operations

//Isolated Margin
{
    "topic": "/contract/position:XBTUSDTM",
    "type": "message",
    "data": {
        "symbol": "XBTUSDM",
        "maintMarginReq": 0.025,
        "riskLimit": 4,
        "realLeverage": 15.163955758,
        "crossMode": false,
        "delevPercentage": 1,
        "openingTimestamp": 1717582301254,
        "autoDeposit": false,
        "currentTimestamp": 1717724618516,
        "currentQty": 2,
        "currentCost": -0.0000287732,
        "currentComm": 0.0000012641,
        "unrealisedCost": -0.0000285718,
        "realisedCost": 0.0000010627,
        "isOpen": true,
        "markPrice": 71509.37,
        "markValue": -0.0000279684,
        "posCost": -0.0000285718,
        "posCross": 0.0000000067,
        "posInit": 0.000001461,
        "posComm": 0.0000000338,
        "posLoss": 0.0000002267,
        "posMargin": 0.0000012748,
        "posFunding": -0.0000002067,
        "posMaint": 0.0000008911,
        "maintMargin": 0.0000018782,
        "avgEntryPrice": 69999.0900118298,
        "liquidationPrice": 69071.5062768731,
        "bankruptPrice": 67085.2788064187,
        "settleCurrency": "XBT",
        "changeReason": "positionChange",
        "riskLimitLevel": 1,
        "realisedGrossCost": -0.0000002014,
        "realisedGrossPnl": 0.0000002014,
        "realisedPnl": 0.0000013973,
        "unrealisedPnl": 0.0000006034,
        "unrealisedPnlPcnt": 0.0211,
        "unrealisedRoePcnt": 0.413,
        "leverage": 15.163955758,
        "marginMode": "ISOLATED", 
        "positionSide": "BOTH" 
    },
    "subject": "position.change",
    "userId": "665ec530aa70390001d22576",
    "channelType": "private"
}

//Cross Margin
{
    "topic": "/contract/position:XBTUSDTM",
    "type": "message",
    "data": {
        "symbol": "XBTUSDTM",
        "crossMode": true,
        "delevPercentage": 0.06,
        "openingTimestamp": 1717639498983,
        "currentTimestamp": 1717724686618,
        "currentQty": -2,
        "currentCost": -136.002,
        "currentComm": 0.06739824,
        "unrealisedCost": -136.002,
        "realisedCost": 0.06739824,
        "isOpen": true,
        "markPrice": 70778.04,
        "markValue": -141.55608,
        "posCost": -136.002,
        "posInit": 5.4509819612,
        "posMargin": 5.6735903779,
        "avgEntryPrice": 68001,
        "liquidationPrice": 80700.49720065,
        "bankruptPrice": 81152.42267235,
        "settleCurrency": "USDT",
        "changeReason": "positionChange",
        "realisedGrossCost": 0,
        "realisedGrossPnl": 0,
        "realisedPnl": -0.09580416,
        "unrealisedPnl": -5.55408,
        "unrealisedPnlPcnt": -0.0408,
        "unrealisedRoePcnt": -1.0189,
        "leverage": 24.95, 
        "marginMode": "CROSS", // CROSS,ISOLATED
        "positionSide": "BOTH"
    },
    "subject": "position.change",
    "userId": "665ec530aa70390001d22576",
    "channelType": "private"
}
  • 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.