Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.92 KB

README.md

File metadata and controls

29 lines (22 loc) · 1.92 KB

Crypto OHLCV (Open High Low Close Volume)

Python 3.8 Code style: black MIT License


crypto-ohlcv is a simple Python script that lets you fetch historical OHLCV data from ccxt supported exchanges. I wrote this script, because my other script focussed solely on Binance, whereas this one supports many exchanges. It consists of one simple function called fetch_data(), that returns a pandas Dataframe, readible by TensorTrade.

How to use

  • Add ohlcv.py located in src to same directory you're working in.
  • Write: from ohlcv import fetch_data.
  • To get the latest 500 daily data points of OHLCV on the BTC/USDT pair from Binance, write: fetch_data(exchange='binance', symbol="BTC/USDT", timeframe='1d', limit=500).
  • The result will be a pandas DataFrame consisting of the latest 500 daily candles of BTC/USDT on Binance.

Supported exchanges

The exchange parameter should be one of the exchanges supported by ccxt, you can find the supported exchanges here.

Symbols

Symbol can be any pair available on the specified exchange.

Time frames

Supported time frames are: '1m', '3m', '5m', '15m', '30m', '1h', '2h', '4h', '6h', '8h', '12h', '1d', '3d', '1w', '1M'.

Limit

Limit is the number of rows you would like to have returned, leaving this unspecified will return most available. Using since as parameter will change the starting point of gathering the data, this is an integer consisting of UTC timestamp in milliseconds. You can also specify it as a string or datetime object, it will automatically be converted to the right format.