Skip to content
This repository has been archived by the owner on Oct 31, 2020. It is now read-only.

strong-roots-capital/bitmex-candle-to-record

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bitmex-candle-to-record Build status npm version codecov

Map a BitMEX Candle to a talib Record

Install

npm install bitmex-candle-to-record

Use

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'))
}) ()

Notes

BitMEX stores the time of the candle close in the timestamp field as opposed to the candle open (that most exchanges use). To convert this representation of a candle to a Record this API subtracts the length of the session from each timestamp, so the apparent time of a Record will not match its associated Candle.

Related