This repo explores some ideas how we might acquire data from various exchanges.
NOTE: I did not use the famous ccxt
library (trying to keep it simple)
My hope is to expand this conversation and see how this can meet the needs of the task.
- Python 3.x (prefer a later version)
- Timescale DB instance (see @sam for the credentials)
- Clone this repo
- create a virtual environment
- run
pip install -r requirements.txt
- in the
coinbase/models.py
file date thePASS
variable with the password. (I know, i'm lazy here) - done
I used Typer, a popular python package for making nice command line tools.
Simply tun python crawler.py
and you will see the options available to you.
There are two commands: acquire all trading pairs and acquire full kline data for a given pair.
python crawler.py coinbase all-pairs
and you should see the script kick off. It
pulls the pairs from the coinbase API and the validates it against the database. Changes in the
status are flagged and updated. No changes are simply ignored.
python coinbase.py fetch-all-klines BTC-USD
will being the process of querying the api and
inserting klines into the database. Duplicate entires are ignored. It will continue to paginate
backwards in time until no more pairs are read.
There is a schema.sql
auto-generated, but it is untested if you can import it.
Pycharm is a bit funky with DDL generation.