tardis-dev built-in normalizers
const { streamNormalized, normalizeTrades, normalizeBookChanges,
normalizeDerivativeTickers } = require('tardis-dev')
async function run() {
// or replayNormalized to replay normalized historical data
const messages = streamNormalized(
{
exchange: 'deribit',
symbols: ['BTC-PERPETUAL']
},
normalizeTrades,
normalizeBookChanges,
normalizeDerivativeTickers
)
for await (const message of messages) {
if (message.type === 'book_change') {
console.log('book_change', message)
// process normalized book change
}
if (message.type === 'trade') {
console.log('trade', message)
// process normalized trade
}
if (message.type === 'derivative_ticker') {
console.log('derivative_ticker', message)
// process normalized derivative_ticker
}
}
}
run()
no comments