This channel sends a trade message whenever a trade occurs at Bitfinex. It includes all the pertinent details of the trade, such as price, size and time.
here is an example of a real trade
[ 5, 'te', '1234-BTCUSD', 1443659698, 236.42, 0.49064538 ]
[ 5, 'tu', '1234-BTCUSD', 15254529, 1443659698, 236.42, 0.49064538 ]
// request
{
"event": "subscribe",
"channel": "trades",
"pair": "BTCUSD"
}
// response
{
"event": "subscribed",
"channel": "trades",
"chanId": "<CHANNEL_ID>",
"pair":"<PAIR>"
}
// snapshot
[
"<CHANNEL_ID>",
[
[
"<SEQ> OR <ID>",
"<TIMESTAMP>",
"<PRICE>",
"<AMOUNT>"
],
[
"..."
]
]
]
// updates
[
"<CHANNEL_ID>",
"te",
"<SEQ>",
"<TIMESTAMP>",
"<PRICE>",
"<AMOUNT>"
]
[
"<CHANNEL_ID>",
"tu",
"<SEQ>",
"<ID>",
"<TIMESTAMP>",
"<PRICE>",
"<AMOUNT>"
]
Fields
Fields | Type | Description |
---|---|---|
SEQ | string | Trade sequence id |
ID | int | Trade database id |
TIMESTAMP | int | Unix timestamp of the trade. |
PRICE | float | Price at which the trade was executed |
±AMOUNT | float | How much was bought (positive) or sold (negative). |
The order that causes the trade determines if it is a buy or a sell.
NOTE
SEQ is different from canonical ID. Websocket server uses SEQ strings to push trades with low latency. After a “te” message you receive shortly a “tu” message that contains the real trade “ID”.