Kaiko - Bittrex Python index
A python module that provides easier access to the Kaiko Bittrex Historical trade data. Assuming that you've bought the files from here, you can now use these (relativelly) simple 2 steps to process them.
- Create an
index.csvfile. We assume that you have unziped the file and when you
ls Bittrexyou see the pairs e.g.
8BITBTCetc. Then you run:
find Bittrex -type f | grep -v ".DS_Store" > index.csvand an
index.csvfile must have been created for you. This file has all the
.csv.gzfiles of the archive.
- When you install with
pip install kaikobittrex, you can create an
Indexobject from Python and access the content of those files like this:
#!/usr/bin/env python from kaikobittrex import Index idx = Index.from_file() def process_pair(year, month, day, pair, f): for lineno, line in enumerate(f.readlines()): line = line.strip() if lineno == 0: assert line == "id,exchange,symbol,date,price,amount,sell" else: record = idx.parse_line(line) print record idx.process_all(process_pair)
There are additional
process_* methods that allow you to process subset of those data.
process_day(self, year, month, day, f) and
process_pair(self, year, month, day, pair, f) all take the same type of callback argument
f and process the subset of records you defined. The
Index object also exposes the
index member which has records for given date/pair, the
pairs member that has all available pairs and the
pairs_map member that maps pairs to coin base/quote pairs. See the test file for more details.
python setup.py sdist,
twine upload dist/*.