Download on-chain data for bitcoin (works for cryptoquant)
Project description
OCFINANCE (Works with Cryptoquant)
ocfinance
is a python package that enables you to download on-chain data from various sources, including Cryptoquant, CheckOnChain, etc.
Features
- Easy Data Download: Download on-chain data from various sources with a single line of code.
- CSV Export: Save data as CSV files for easy analysis in Excel or other tools.
- Pandas Integration: Work with data directly as a pandas DataFrame for simple manipulation and analysis.
- Customizable Queries: Specify start and end date parameters.
Installation
To install the ocfinance
package, use pip:
pip install ocfinance
Supported Websites
- CheckOnChain
- ChainExposed
- Woocharts
- Cryptoquant (follow the guide below)
- Bitbo Charts
- Bitcoin Magazine Pro
Usage
To download the data of a chart, simply obtain the URL and pass it to the download function
import ocfinance as of
# Download the data from the specified URL
data = of.download("https://charts.checkonchain.com/btconchain/pricing/pricing_picycleindicator/pricing_picycleindicator_light.html")
# Usage examples
# Export as CSV
data.to_csv('out.csv')
# Plot
data.plot()
Advanced usage
# Filter by dates (Pass dates in YYYY-mm-dd format)
filtered = of.download(
"https://charts.checkonchain.com/btconchain/pricing/pricing_picycleindicator/pricing_picycleindicator_light.html",
start='2023-01-01',
end='2023-12-31'
)
Cryptoquant guide
To access data from Cryptoquant, you must have an account. Your email and password are required and should be passed to the download function (preferably using environment variables)
import os
import ocfinance as of
# Setup environment variables
email = os.getenv('CRYPTOQUANT_EMAIL')
password = os.getenv('CRYPTOQUANT_PASSWORD')
# Download the data
data = of.download(
"https://cryptoquant.com/analytics/query/66451fd6f3cac64b85386229?v=66451fd6f3cac64b8538622b",
email=email,
password=password
)
To obtain the url, click the source button and copy the URL of the page.
Contributing
If you would like to contribute to the project, feel free to submit a pull request or open an issue for discussion.
Running Tests
Optional
To run integration tests for Cryptoquant, you need to provide your account's email and password in a .env
file. Copy the provided .env.sample
file, rename it to .env
, and fill in your credentials. Without this file, the tests using it will be skipped.
Running the tests
- Clone the repository
git clone https://github.com/dhruvan2006/ocfinance
- Install the required packages
pip install -r requirements.txt
- Run the tests
pytest
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
Built Distribution
File details
Details for the file ocfinance-0.0.8.tar.gz
.
File metadata
- Download URL: ocfinance-0.0.8.tar.gz
- Upload date:
- Size: 237.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f83f967ef9d41ad0f30904ab6b80da20e5a3dd5183d40d95b30e0f05de91d67 |
|
MD5 | 42524ac301d0ba4d941488a3b82a4c0e |
|
BLAKE2b-256 | 31bfd88138f4d056681dd42dc0f25796b489e1486f5e2ac19ae046ff7f630693 |
File details
Details for the file ocfinance-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: ocfinance-0.0.8-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d309ae0b7e180d91a65fea15e268a475598704fdd5e0b750eb35c42cc3a29fb |
|
MD5 | 03fa96bd3959f393f71a5ec627298b3a |
|
BLAKE2b-256 | 8ca90c02aad94d440640813fc692175ed3617422f7145b483dce319529e62f2c |