Map a BitMEX Candle to a talib Record
npm install bitmex-candle-to-record> Map a BitMEX Candle to a talib Record
`` shell`
npm install bitmex-candle-to-record
` typescript
import bitmexCandleToRecord from 'bitmex-candle-to-record'
import Record from 'timeseries-record'
import { BitmexAPI } from 'bitmex-node'
const bitmex = new BitmexAPI()
(async () => {
const quotes = await bitmex.Trade.getBucketed({
binSize: '1d',
partial: false,
symbol: 'XBTUSD',
reverse: true
})
const records: Record[] = quotes.map(q => bitmexCandleToRecord(q, '1d'))
}) ()
`
BitMEX stores the time of the candle _close_ in the timestamp fieldRecord
as opposed to the candle open (that most exchanges use). To convert
this representation of a candle to a this API subtracts thetimestamp
length of the session from each , so the apparent time of aRecord will not match its associated Candle`.