tardis-dev historicial order book reconstruction for BitMEX

node v12.22.6
version: 1.0.0
endpointsharetweet
const { replayNormalized, normalizeBookChanges, OrderBook } = require('tardis-dev') const books = { XBTUSD: new OrderBook(), ETHUSD: new OrderBook() } async function reconstructHistoricalLOB() { const messages = replayNormalized( { exchange: 'bitmex', symbols: ['XBTUSD', 'ETHUSD'], from: '2019-05-01', to: '2019-05-02' }, normalizeBookChanges ) for await (const message of messages) { const orderBook = books[message.symbol] if (message.type === 'book_change') { orderBook.update(message) } const timestamp = message.localTimestamp.toISOString() // print best bid/ask for every exchange tick console.log(timestamp, orderBook.bestAsk(), orderBook.bestBid()) } } reconstructHistoricalLOB()
Loading…

no comments

    sign in to comment