Skip to main content

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

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.

Click the source button Copy the url

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

  1. Clone the repository
git clone https://github.com/dhruvan2006/ocfinance
  1. Install the required packages
pip install -r requirements.txt
  1. Run the tests
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ocfinance-0.0.9.tar.gz (238.1 kB view details)

Uploaded Source

Built Distribution

ocfinance-0.0.9-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file ocfinance-0.0.9.tar.gz.

File metadata

  • Download URL: ocfinance-0.0.9.tar.gz
  • Upload date:
  • Size: 238.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.8

File hashes

Hashes for ocfinance-0.0.9.tar.gz
Algorithm Hash digest
SHA256 8fa6840dcf0fe656509417dcccd28d0cf6929dcedf94637de4e37d74ee925e65
MD5 5e79a5d464c3e53cd06532230c009043
BLAKE2b-256 4465d835f9d44d6f0da0d4423050f84a6e55f8cfb640c87b3c287509b6e210aa

See more details on using hashes here.

File details

Details for the file ocfinance-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: ocfinance-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.8

File hashes

Hashes for ocfinance-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 40b4255fc45be6e62136a61e3f29b0c2194fea52933e3c97b7801d5639ef1d5c
MD5 5c12d944043fe7dc4b893025ba091517
BLAKE2b-256 6ece6e17c32b736320d2b7f4f82b4174890a6f5d3e5a39f9492abce248787c5e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page