The ticker endpoint provides a high level overview of the state of the market for a specified pair. It shows the current best bid and ask, the last traded price, as well as information on the daily volume and price movement over the last day.
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: 'ticker',
symbol: 'tBTCUSD'
})
w.on('open', () => w.send(msg))
wscat -c wss://api-pub.bitfinex.com/ws/2
{ "event": "subscribe", "channel": "ticker", "symbol": "tBTCUSD" }
ws = websocket.WebSocketApp('wss://api-pub.bitfinex.com/ws/2')
ws.on_open = lambda self: self.send('{ "event": "subscribe", "channel": "ticker", "symbol": "tBTCUSD"}')
ws.on_message = lambda self, evt: print (evt)
// request
{
event: "subscribe",
channel: "ticker",
symbol: SYMBOL
}
// response - trading
{
event: "subscribed",
channel: "ticker",
chanId: CHANNEL_ID,
symbol: SYMBOL,
pair: PAIR
}
{"event":"subscribed","channel":"ticker","chanId":224555,"symbol":"tBTCUSD","pair":"BTCUSD"}
// response - funding
{
event: "subscribed",
channel: "ticker",
chanId: CHANNEL_ID,
symbol: SYMBOL,
currency: CURRENCY
}
{"event":"subscribed","channel":"ticker","chanId":232591,"symbol":"fUSD","currency":"USD"}
// Trading pairs
[
443378, //CHANNEL_ID
[
7616.5, //BID
31.89055171, //BID_SIZE
7617.5, //ASK
43.358118629999986, //ASK_SIZE
-550.8, //DAILY_CHANGE
-0.0674, //DAILY_CHANGE_RELATIVE
7617.1, //LAST_PRICE
8314.71200815, //VOLUME
8257.8, //HIGH
7500 //LOW
] //UPDATE
]
// Funding pairs
[
234509, //CHANNEL_ID
[
0.0003193369863013699, //FRR
0.0002401, //BID
30, //BID_PERIOD
3939629.6177260396, //BID_SIZE
0.00019012, //ASK
2, //ASK_PERIOD
307776.1592138799, //ASK_SIZE
-0.00005823, //DAILY_CHANGE
-0.2344, //DAILY_CHANGE_RELATIVE
0.00019016, //LAST_PRICE
122156333.45260866, //VOLUME
0.00027397, //HIGH
6.8e-7, //LOW
null, //PLACEHOLDER
null, //PLACEHOLDER
3441851.73330503 //FRR_AMOUNT_AVAILABLE
] //UPDATE
]
// Trading pairs
[
443378, //CHANNEL_ID
[
7616.5, //BID
31.89055171, //BID_SIZE
7617.5, //ASK
43.358118629999986, //ASK_SIZE
-550.8, //DAILY_CHANGE
-0.0674, //DAILY_CHANGE_RELATIVE
7617.1, //LAST_PRICE
8314.71200815, //VOLUME
8257.8, //HIGH
7500 //LOW
] //UPDATE
]
// Funding pairs
[
234509, //CHANNEL_ID
[
0.0003193369863013699, //FRR
0.0002401, //BID
30, //BID_PERIOD
3939629.6177260396, //BID_SIZE
0.00019012, //ASK
2, //ASK_PERIOD
307776.1592138799, //ASK_SIZE
-0.00005823, //DAILY_CHANGE
-0.2344, //DAILY_CHANGE_RELATIVE
0.00019016, //LAST_PRICE
122156333.45260866, //VOLUME
0.00027397, //HIGH
6.8e-7, //LOW
null, //PLACEHOLDER
null, //PLACEHOLDER
3441851.73330503 //FRR_AMOUNT_AVAILABLE
] //UPDATE
]
Request fields
Fields | Type | Description |
---|---|---|
SYMBOL | String | Trading pair or funding currency |
Stream data
Index | Field | Type | Description |
---|---|---|---|
[0] | CHANNEL_ID | Int | Identification number assigned to the channel for the duration of this connection. |
[1] | UPDATE | Array | Array with relevant data (trading snapshot/update or funding snapshot/update) |
Trading snapshot/update (Index [1])
Index | Field | Type | Description |
---|---|---|---|
[0] | BID | Float | Price of last highest bid |
[1] | BID_SIZE | Float | Sum of the 25 highest bid sizes |
[2] | ASK | Float | Price of last lowest ask |
[3] | ASK_SIZE | Float | Sum of the 25 lowest ask sizes |
[4] | DAILY_CHANGE | Float | Amount that the last price has changed since yesterday |
[5] | DAILY_CHANGE_RELATIVE | Float | Relative price change since yesterday (*100 for percentage change) |
[6] | LAST_PRICE | Float | Price of the last trade. |
[7] | VOLUME | Float | Daily volume |
[8] | HIGH | Float | Daily high |
[9] | LOW | Float | Daily low |
Funding snapshot/update (Index [1])
Index | Field | Type | Description |
---|---|---|---|
[0] | FRR | Float | Flash Return Rate - average of all fixed rate funding over the last hour (funding tickers only) |
[1] | BID | Float | Price of last highest bid |
[2] | BID_PERIOD | Int | Bid period covered in days (funding tickers only) |
[3] | BID_SIZE | Float | Sum of the 25 highest bid sizes |
[4] | ASK | Float | Price of last lowest ask |
[5] | ASK_PERIOD | Int | Ask period covered in days (funding tickers only) |
[6] | ASK_SIZE | Float | Sum of the 25 lowest ask sizes |
[7] | DAILY_CHANGE | Float | Amount that the last price has changed since yesterday |
[8] | DAILY_CHANGE_RELATIVE | Float | Relative price change since yesterday (*100 for percentage change) |
[9] | LAST_PRICE | Float | Price of the last trade. |
[10] | VOLUME | Float | Daily volume |
[11] | HIGH | Float | Daily high |
[12] | LOW | Float | Daily low |
[ . . . ] | |||
[15] | FRR_AMOUNT_AVAILABLE | Float | The amount of funding that is available at the Flash Return Rate (funding tickers only) |