tardis-node seamless switching between real-time streaming and historical market data replay

node v12.22.12
version: 1.0.0
endpointsharetweet
const { tardis, normalizeTrades, compute, computeTradeBars, Trade } = require('tardis-node') async function produceVolumeBasedTradeBars(messages) { const withVolumeTradeBars = compute( messages, computeTradeBars({ kind: 'volume', interval: 100 * 1000 // aggregate by 100k contracts volume }) ) for await (const message of withVolumeTradeBars) { if (message.type === 'trade_bar') { console.log(message.name, message) } } } const historicalMessages = tardis.replayNormalized( { exchange: 'bitmex', symbols: ['XBTUSD'], from: '2019-08-01', to: '2019-08-02' }, normalizeTrades ) const realTimeMessages = tardis.streamNormalized( { exchange: 'bitmex', symbols: ['XBTUSD'] }, normalizeTrades ) await produceVolumeBasedTradeBars(historicalMessages) // or for real time data based bars // await produceVolumeBasedTradeBars(realTimeMessages)
Loading…

no comments

    sign in to comment