Your request could not be processed at this time. Please try again in a few seconds. If the problem persists contact support@bitfloor.com

Market Data : websocket

This page contains information about using the Websocket Market Data API. Visit the api overview page here if you are unsure of which API to use or what an API is for.

Gathering market data through the websocket api does not require any credentials. Our market data is freely available to anyone who wishes to consume it. You DO NOT need to use your api key to request this data.

The websocket stream provides full information about all of the order flow and executions as they happen. It is up to your client to consume this information in the proper order.

overview

The websocket stream is available using the socket.io library and protocol. Implementations are available for various languages and platforms.

To receive market data for a given product you will need to specify the product feed. The feed URL is:

https://feed.bitfloor.com/{product_id}

Once connected, you will be able to request current book and tick state as well as listen for market data events. The events are listed below with their names in parenthesis.

Order New (order_new)

Order New is emitted when the matching engine receives a new valid order. The order has not yet been executed against or put on the order book. It is simply an acknowledgement that the matching engine has accepted the order.

This event will be emitted for ALL new orders received by the matching engine. Unless you are interested in potential order flow you can generally ignore this message since it does not indicate a change in market state.

field type notes
seq integer message sequence number (always increasing for new messages)
timestamp float timestamp when event happened at the exchange (sss.uuuuuu)
order_id string unique id of the order, subsequent messages reference this (uuid)
side integer 0 for buy, 1 for sell
price number the price of the order
size number the size of the order

Order Open (order_open)

Order Open is emitted when any part of an order has been put on the visible order book. This will indicate that the order can be executed against by future incoming orders. It will remain in the open state and on the book until canceled or filled (see order_done).

If you are building your own order book you should use this event to update the book state. This event WILL NOT be emitted for orders which execute immediately and never go on the order book.

field type notes
seq integer message sequence number (always increasing for new messages)
timestamp float timestamp when event happened at the exchange (sss.uuuuuu)
order_id string unique id of the order, subsequent messages reference this (uuid)
side integer 0 for buy, 1 for sell
price number the price of the order
size number amount of the order that will go on the order book

Order Done (order_done)

Order Done is emitted when the order will no longer be executed against. The order was either filled or canceled.

This event will be emitted for ALL orders. If the order was on the order book, you will need to update your order book accordingly.

field type notes
seq integer message sequence number (always increasing for new messages)
timestamp float timestamp when event happened at the exchange (sss.uuuuuu)
order_id string unique id of the order, subsequent messages reference this (uuid)
side integer 0 for buy, 1 for sell
price number the price of the order
size number amount of the order remaining (0 for filled orders)
reason string 'filled' or 'cancelled'

Match (match)

A match is emitted when a trade happens. This indicates that two orders crossed and some amount of each was filled. A single match event is emitted even though two orders are involved in the transaction.

If you are building a book, you should update the book state with the information from this message. Even if a match occurs for the entire size of an order, there will still be an order done event indicating the matching engine is finished with the order.

field type notes
seq integer message sequence number (always increasing for new messages)
timestamp float timestamp when event happened at the exchange (sss.uuuuuu)
taker_order_id string order id of the taking side (the side that was NOT on the order book)
provider_order_id string order id of the providing side (the existing order on the order book)
provider_side integer 0 for buy, 1 for sell (taker side is just the opposite)
price number the price at which the match occurred (this will match the provider order price)
size number amount involved in the trade

Book (book)

The book event is emitted in response to a book message from the client. The book request has no information and is simply a blank socket.io event sent by the client to our websocket server.

The event contains a sequence number which corresponds to last feed message sequence number the book information was updated by. Any feed sequence messages you received with a sequence number less than or equal to the one in the book event should be ignored when building and tracking book state.

field type notes
seq integer message sequence number (always increasing for new messages)
bids array [ [price, size], ...]
asks array [ [price, size], ...]

example

Below is a basic code sample (javascript) of how to consume the websocket events.

// connect to the socket.io stream
var feed = io.connect('https://feed.bitfloor.com/1');

// callback for new orders
feed.on('order_new', function(details) {
        console.log(details);
});

// callback for orders going to the order book
feed.on('order_open', function(details) {
        console.log(details);
});

// orders which will no longer be executed against
feed.on('order_done', function(details) {
        console.log(details);
});

// full book state (must be requested)
feed.on('book', function(book) {
        console.log(book);
});

// request the book state (optional)
feed.emit('book');