1.0.4 • Published 1 year ago

binance-history-downloader v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

binance-history-downloader

Installing

yarn add binance-history-downloader

Usage

This package can be used either by importing it as module when you want to plug this directly into your processing application:

import getBinanceData from 'binance-history-downloader';

// will get an array of one minute kline data for BTCUSDT between Jan and Dec 2021
const data = await getBinanceData(
  'BTCUSDT',
  '1m',
  new Date('2021-01-01'),
  new Date('2021-12-01')
);

Or directly through npx which will then ask you about the query parameters and produce a CSV file

npx binance-history-downloader@latest
✔ What currency pair to fetch? · BTCUSDT
✔ Which period should be used? · 1h
✔ What should be the start month? (YYYY-MM) · 2020-01
✔ What should be the end month? (YYYY-MM) · 2020-02
✔ What should be the filename for the csv file? · data.csv

API

getBinanceData

async function getBinanceData(
  currencyPair: string, // follows binance currency pair format
  period: KlinePeriod, // see below
  startDate: Date, // month in which to start
  endDate: Date // month in which to end
): Promise<KlineData[]>

KlinePeriod

type KlinePeriod =
  | '1m'
  | '3m'
  | '5m'
  | '15m'
  | '30m'
  | '1h'
  | '2h'
  | '4h'
  | '6h'
  | '8h'
  | '12h'
  | '1d'
  | '3d'
  | '1w'
  | '1mo';

KlineData

type KlineData = {
  openTime: number;
  open: number;
  high: number;
  low: number;
  close: number;
  volume: number;
  closeTime: number;
  quoteAssetVolume: number;
  numberOfTrades: number;
  takerBuyBaseAssetVolume: number;
  takerBuyQuoteAssetVolume: number;
  ignore: boolean;
};
1.0.4

1 year ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago