We've detected that you're using a small display. Want to switch to the mobile version of the site?

API Documentation

Example

Node.js example of how to connect to the push API (requires autobahn): http://pastebin.com/dMX7mZE0

Push API

The best way to get public data updates on markets is via the push API, which pushes live ticker, order book, trade, and Trollbox updates over WebSockets using the WAMP protocol. In order to use the push API, connect to wss://api.poloniex.com and subscribe to the desired feed.

Ticker

In order to receive ticker updates, subscribe to "ticker". Updates will be in the following format:

['BTC_BBR','0.00069501','0.00074346','0.00069501','-0.00742634','8.63286802','11983.47150109',0,'0.00107920','0.00045422']

Appropriate labels for these data are, in order: currencyPair, last, lowestAsk, highestBid, percentChange, baseVolume, quoteVolume, isFrozen, 24hrHigh, 24hrLow

Order Book and Trades

To receive order book and trade updates, subscribe to the desired currencyPair, e.g. "BTC_XMR". There are two types of order book updates:

[{data: {rate: '0.00300888', type: 'bid', amount: '3.32349029'},type: 'orderBookModify'}]

[{data: {rate: '0.00311164', type: 'ask' },type: 'orderBookRemove'}]

Updates of type orderBookModify can be either additions to the order book or changes to existing entries. The value of 'amount' indicates the new total amount on the books at the given rate — in other words, it replaces any previous value, rather than indicates an adjustment to a previous value.

Trade history updates are provided in the following format:

[{data: {tradeID: '364476',rate: '0.00300888',amount: '0.03580906',date: '2014-10-07 21:51:20',total: '0.00010775',type: 'sell'},type: 'newTrade'}]

The dictionary portion of each market message ("kwargs" in the Node.js example) will contain a sequence number with the key "seq". In order to keep your order book consistent, you will need to ensure that messages are applied in the order of their sequence numbers, even if they arrive out of order. In some markets, if there is no update for more than 1 second, a heartbeat message consisting of an empty argument list and the latest sequence number will be sent. These will go out once per second, but if there is no update for more than 60 seconds, the heartbeat interval will be reduced to 8 seconds until the next update.

Several order book and trade history updates will often arrive in a single message. Be sure to loop through the entire array, otherwise you will miss some updates.

Trollbox Messages

In order to receive new Trollbox messages, subscribe to "trollbox". Messages will be given in the following format:

['trollboxMessage',2094211,'boxOfTroll','Trololol',4]

Appropriate labels for these data are, in order: type, messageNumber, username, message, reputation