Status

Subscribe to and receive different types of platform information - currently supports derivatives pair status and liquidation feed.

const ws = require('ws')
const w = new ws('wss://api-pub.bitfinex.com/ws/2')

w.on('message', (msg) => console.log(msg))

let msg = JSON.stringify({ 
  event: 'subscribe', 
  channel: 'status', 
  key: 'deriv:tBTCF0:USTF0' 
})

w.on('open', () => w.send(msg))
wscat -c wss://api-pub.bitfinex.com/ws/2
{ "event": "subscribe",  "channel": "status",  "key": "deriv:tBTCF0:USTF0" }
ws = websocket.WebSocketApp('wss://api-pub.bitfinex.com/ws/2')

ws.on_open = lambda self: self.send('{ "event": "subscribe", "channel": "status", "key": "deriv:tBTCF0:USTF0"}')

ws.on_message = lambda self, evt:  print (evt)

// request
{ 
  event: "subscribe", 
  channel: "status", 
  key: KEY
}

// response - 
{
   event: "subscribed",
   channel: "status",
   chanId: CHANNEL_ID,
   key: KEY
}

//Derivative pair status
{"event":"subscribed","channel":"status","chanId":335856,"key":"deriv:tBTCF0:USTF0"}

//Liquidation feed
{"event":"subscribed","channel":"status","chanId":91684,"key":"liq:global"}
// Derivatives Status

[
  335856, //CHANNEL_ID
  [
    1596124822000, //TIME_MS
    null, //PLACEHOLDER
    0.896, //DERIV_PRICE
    0.771995, //SPOT_PRICE
    null, //PLACEHOLDER
    1396531.67460709, //INSURANCE_FUND_BALANCE
    null, //PLACEHOLDER
    1596153600000, //NEXT_FUNDING_EVT_TIMESTAMP_MS
    0.0001056, //NEXT_FUNDING_ACCRUED
    6, //NEXT_FUNDING_STEP
    null, //PLACEHOLDER
    -0.01381344, //CURRENT_FUNDING
    null, //PLACEHOLDER
    null, //PLACEHOLDER
    0.7664, //MARK_PRICE
    null, //PLACEHOLDER
    null, //PLACEHOLDER
    246502.09001551, //OPEN_INTEREST
    null, //PLACEHOLDER
    null, //PLACEHOLDER
    null, //PLACEHOLDER
    null, //CLAMP_MIN
    0.3 //CLAMP_MAX
  ] //DERIVATIVE_STATUS_ARRAY
]

// Liquidation feed updates

[
  91684, //CHANNEL_ID
  [
    [
      "pos", //MSG_TYPE
      142397657, //POS_ID
      1574697680828.2002, //TIME_MS
      null, //PLACEHOLDER
      "tBSVUSD", //SYMBOL
      -2.62932, //AMOUNT
      91.583875238719, //BASE_PRICE
      null, //PLACEHOLDER
      1, //IS_MATCH
      1, //IS_MARKET_SOLD
      null, //PLACEHOLDER
      112.27 //LIQUIDATION_PRICE
    ] //LIQUIDATION_ARRAY
  ] //LIQUIDATIONS
]

Request fields

KeysTypeDescription
"deriv:SYMBOL" (e.g. "deriv:tBTCF0:USTF0")StringUsed to subscribe to derivative pair status updates
"liq:global"StringUsed to subscribe to liquidation feed updates

Status update data

IndexFieldTypeDescription
[0]CHANNEL_IDIntIdentification number assigned to the channel for the duration of this connection.
[1]UPDATEArrayDerivative status array or Liquidations array

Derivative status array (Index [1])

Index Field Type Description
[0]TIME_MSIntMillisecond timestamp
[ . . . ]
[2]DERIV_PRICEFloatDerivative book mid price.
[3]SPOT_PRICEFloatBook mid price of the underlying Bitfinex spot trading pair
[ . . . ]
[5]INSURANCE_FUND_BALANCEFloatThe balance available to the liquidation engine to absorb losses.
[ . . . ]
[7]NEXT_FUNDING_EVT_TIMESTAMP_MSIntMillisecond timestamp of next funding event
[8]NEXT_FUNDING_ACCRUEDFloatCurrent accrued funding for next 8h period
[9]NEXT_FUNDING_STEPIntIncremental accrual counter
[ . . . ]
[11]CURRENT_FUNDINGFloatFunding applied in the current 8h period
[ . . . ]
[14]MARK_PRICEFloatPrice based on the BFX Composite Index
[ . . . ]
[17]OPEN_INTERESTFloatCurrent open interest
[ . . . ]
[22]CLAMP_MINFloatRange in the average spread that does not require a funding payment
[23]CLAMP_MAXFloatFunding payment cap

Liquidations (Index [1])

IndexFieldTypeDescription
[0....n]LIQUIDATION_ARRAYArrayLiquidation array

Liquidation array (Index [1][0...n])

Index Field Type Description
[0]MSG_TYPEStringType of message ('pos')
[1]POS_IDIntPosition id
[2]TIME_MSIntMillisecond timestamp
[ . . . ]
[4]SYMBOLStringTrading pair
[5]AMOUNTFloatAmount of the liquidated position
[6]BASE_PRICEFloatBase price of the liquidated position
[ . . . ]
[8]IS_MATCHInt0 -> initial liquidation trigger, 1 market execution
[9]IS_MARKET_SOLDInt0 -> direct sell into the market, 1 position acquired by the system
[ . . . ]
[11]LIQUIDATION_PRICEFloatPrice at which the liquidation was triggered