cbhist
A python library for pulling in historical candles from coinbase.
Dependencies 🌐
Python 3.11.6:
Raison D'être 💭
The coinbase exchange API lets you pull down historical OHLC data but only 300 candles at a time. If you are trying to get data at the minute resolution this can take a long time. Typically the approach is to iterate across a time series and perform a request for each time chunk, however this can be sped up greatly by doing a binary search before doing an iterative pull to determine when the asset begins to have candles. Formalising this into a proper library produces a dataframe made it easier to work in different projects than re-inventing the wheel each time.
Installation 📥
This is a python package hosted on pypi, so to install simply run the following command:
pip install cbhist
Usage example 👀
To pull a dataframe containing all the candles for a coinbase product:
import datetime
from cbhist.historical import fetch_historical
granularity = 60 # Candle for every minute
df = fetch_coinbase("ETH-USD", granularity, datetime.datetime(2010, 1, 1))
This results in a dataframe with a datetime index and OHLC (+ volume) columns.
License 📝
The project is available under the MIT License.
Metadata
Release files for cbhist 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cbhist-0.0.4.tar.gz | 4.5 kB | Without provenance | Details |
Release files / cbhist-0.0.4.tar.gz
| Download URL | cbhist-0.0.4.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a0af7fff077f4fe7a130c62a3e18efba572403f8e964dbf6f6041a63371d89b
|
|
BLAKE2b-256 checksum How to use checksums |
0daf7e9fbc9655ebd969013ed438831a9d490584bd3a96303345e30b8c3a9603
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Security for cbhist 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.