全部倉位變化

Topic: /contract/positionAll

倉位操作引起的倉位變化
  //倉位操作引起的倉位變化
  { 
    "type": "message",
    "userId": "5c32d69203aa676ce4b543c7",  // 不推薦使用, 後續版本將刪除
    "channelType": "private",
    "topic": "/contract/position:XBTUSDM", 	
    "subject": "position.change", 
      "data": {
      "realisedGrossPnl": 0E-8,                //累加已實現毛利
      "symbol":"XBTUSDM",                      //有效合約代碼
      "crossMode": false,                      //是否全倉
      "liquidationPrice": 1000000.0,           //強平價格
      "posLoss": 0E-8,                         //手動追加的保證金
      "avgEntryPrice": 7508.22,                //平均開倉價格
      "unrealisedPnl": -0.00014735,            //未實現盈虧
      "markPrice": 7947.83,                    //標記價格
      "posMargin": 0.00266779,                 //倉位保證金
      "autoDeposit": false,                    //是否自動追加保證金
      "riskLimit": 100000,                     //風險限額
      "unrealisedCost": 0.00266375,            //未實現價值
      "posComm": 0.00000392,                   //破產費用
      "posMaint": 0.00001724,                  //維持保證金
      "posCost": 0.00266375,                   //倉位價值
      "maintMarginReq": 0.005,                 //維持保證金比例
      "bankruptPrice": 1000000.0,              //破產價格
      "realisedCost": 0.00000271,              //當前累計已實現倉位價值
      "markValue": 0.00251640,                 //標記價值
      "posInit": 0.00266375,                   //槓桿保證金
      "realisedPnl": -0.00000253,              //已實現盈虧
      "maintMargin": 0.00252044,               //倉位保證金
      "realLeverage": 1.06,                    //槓桿倍數
      "changeReason": "positionChange",        //變化原因:marginChange、positionChange、liquidation、autoAppendMarginStatusChange、adl
      "currentCost": 0.00266375,               //當前總倉位價值
      "openingTimestamp": 1558433191000,       //開倉時間
      "currentQty": -20,                       //當前倉位
      "delevPercentage": 0.52,                 //ADL分位數
      "currentComm": 0.00000271,               //當前總費用
      "realisedGrossCost": 0E-8,               //累計已實現毛利價值
      "isOpen": true,                          //是否開倉
      "posCross": 1.2E-7,                      //手動追加的保證金
      "currentTimestamp": 1558506060394,       //當前時間戳
      "unrealisedRoePcnt": -0.0553,            //投資回報率
      "unrealisedPnlPcnt": -0.0553,            //倉位盈虧率
      "settleCurrency": "XBT"                  //結算幣種
      }
  }
  • changeReason說明
    • “marginChange”: 倉位保證金變化;
    • “positionChange”: 倉位變化;
    • “liquidation”: 強平;
    • “autoAppendMarginStatusChange”: 修改是否自動追加保證金;
    • “adl”: 自動減倉;
標記價格變化引起的倉位變化
 //標記價格變化引起的倉位變化
  { 
    "userId": "5cd3f1a7b7ebc19ae9558591",  // 不推薦使用, 後續版本將刪除
    "topic": "/contract/position:XBTUSDM", 	
    "subject": "position.change", 
      "data": {
          "markPrice": 7947.83,                   //標記價格
          "markValue": 0.00251640,                 //標記價值
          "maintMargin": 0.00252044,              //倉位保證金
          "realLeverage": 10.06,                   //槓桿倍數
          "unrealisedPnl": -0.00014735,           //未實現盈虧
          "unrealisedRoePcnt": -0.0553,           //投資回報率
          "unrealisedPnlPcnt": -0.0553,            //倉位盈虧率
          "delevPercentage": 0.52,             //ADL分位數
          "currentTimestamp": 1558087175068,       //當前時間戳
          "settleCurrency": "XBT"                  //結算幣種
      }
  }
資金費用結算
 //資金費用結算
  { 
    "userId": "xbc453tg732eba53a88ggyt8c",  // 不推薦使用, 後續版本將刪除
    "topic": "/contract/position:XBTUSDM",
    "subject": "position.settlement",
    "data": {
        "fundingTime": 1551770400000,          //費用時間
        "qty": 100,                            //倉位數
        "markPrice": 3610.85,                 //結算價格,爲8時刻標記價格,四捨五入到最近合法價格
        "fundingRate": -0.002966,             //結算資金費率
        "fundingFee": -296,                   //資金費用
        "ts": 1547697294838004923,             //當前時間(納秒)
        "settleCurrency": "XBT"                //結算幣種
    }
  }
風險限額調整結果
// Adjustment Result of Risk Limit Level
{ 
  "userId": "xbc453tg732eba53a88ggyt8c", 
  "topic": "/contract/position:ADAUSDTM", 
  "subject": "position.adjustRiskLimit", 
  "data": { 
    "success": true, // 是否成功 
    "riskLimitLevel": 1, // 當前風險限額等級
    "msg": "" // 失敗原因 
  }
} 
  • msg失敗原因有兩種情況:
    • 持倉價值大於風險限額等級額度;
    • 餘額不足,保證金追加失敗。