Extract symbol data as pandas data frames from the Kraken_OHLCVT.zip file of the Kraken exchange
Project description
krakenohlcvt
A python package to handle Kraken exchange historial OHLCVT data without needing to unzip the Kraken_OHLCVT.zip file.
Installation
pip install krakenohlcvt
or
potry add krakenohlcvt
Usage
from krakenohlcvt import KrakenDataHandler
# Enter path to the Kraken zip file:
import os
DATA_PATH = os.path.expanduser("~/Downloads/Kraken_OHLCVT.zip")
# or simpler:
DATA_PATH = "path/to/Kraken_OHLCVT.zip"
# load it
kd = KrakenDataHandler(DATA_PATH)
# you can inspect which symbols it contains:
kd.list_symbols()
# when searching for a specific symbol, search with either "starts_with=" or "contains="
kd.list_symbols(starts_with="ETH")
# then get the timeframe from the specific symbol
df = kd.load_symbol_data("ETHUSDT", "15m")
# if timeframe not in ["1m", "15m", "1h", "1d"], then the '1m' data gets loaded and the timeframe
# inferred from the 1m data!
# save a timeframe of a specific symbol as df pickle:
kd.save_to_df_pickle(symbol="ETHUSDT", timeframe="15m", outpath=os.path.expanduser("~/projects/python/LotusBot/src/backtester/ETHUSDT_15m.csv"), dropna_rows=True)
# convert unix time in the index to human-readable datetime object
[kd.unix_to_datetime(x) for x in df.index] # very slow! a lot faster:
kd.unix_to_datetime(df.index)
# also possible
[datetime.datetime.fromtimestamp(x) for x in df.index]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
krakenohlcvt-0.1.15.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for krakenohlcvt-0.1.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed4b45482ceddc1136f18aa1789ecc9727a1315457c8e63a9ecb47877c1cab51 |
|
MD5 | fabdc6be01f82874e30263b0fb618186 |
|
BLAKE2b-256 | 13128639bd0fbbd8c269f60df9e32b4c20350a579a95961caf2e61a14bcf6107 |