Skip to main content

Python SDK for accessing cryptocurrency high-frequency trading data

Project description

CryptoHFTData Python SDK

PyPI version Python versions License: MIT Documentation Status

A Python SDK for accessing cryptocurrency high-frequency trading data with a simple and intuitive API.

Installation

pip install cryptohftdata

Quick Start

import cryptohftdata as chd

# Get kline/candlestick data
klines = chd.get_klines("BTCUSDT", chd.exchanges.BINANCE_FUTURES, "2025-01-01", "2025-02-01")

# Get orderbook data
orderbook = chd.get_orderbook("ETHUSDT", chd.exchanges.BYBIT_SPOT, "2025-01-01", "2025-02-01")

# Get trade data
trades = chd.get_trades("BTCUSDT", chd.exchanges.BINANCE_SPOT, "2025-01-01", "2025-01-02")

# All methods return pandas DataFrames ready for analysis
print(klines.head())
print(f"Average price: ${klines['close'].mean():.2f}")

Features

  • Simple API: Clean and intuitive interface for accessing cryptocurrency market data
  • Direct pandas Integration: All methods return pandas DataFrames ready for analysis
  • Parquet Support: Efficient data transfer using parquet files for large datasets
  • Multiple Exchanges: Support for Binance and Bybit (both spot and futures markets)
  • Multiple Data Types: Access to klines, orderbook, trades, and ticker data
  • High Performance: Optimized for handling large datasets efficiently with pandas and pyarrow
  • Type Safety: Full type hints for better IDE support and code quality
  • Async Support: Both synchronous and asynchronous APIs available
  • Flexible Date Handling: Support for various date formats and timezones

Supported Exchanges

  • Binance (Spot & Futures)
  • Bybit (Spot & Futures)

More exchanges coming soon...

Documentation

Full documentation is available at cryptohftdata.com/docs

Examples

See the examples directory for more detailed usage examples.

Development

Setting up the development environment

git clone https://github.com/cryptohftdata/sdk.git
cd sdk/python
pip install -e ".[dev]"

Running tests

To run the test suite, navigate to the sdk/python directory and use one of the following commands:

Using pytest (recommended):

pytest

This command will automatically use the configurations specified in pyproject.toml, including test paths and coverage options.

If you need to target a specific test file or directory, you can do so, but be mindful of the addopts in pyproject.toml:

pytest tests/test_client.py

If you don't have pytest or prefer to use the built-in unittest module:

python -m unittest discover tests

Make sure you have an active virtual environment with development dependencies installed. Some tests might require a CRYPTOHFTDATA_API_KEY environment variable to be set for tests that interact with the live API.

Code formatting

black cryptohftdata tests
isort cryptohftdata tests

Type checking

mypy cryptohftdata

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

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

cryptohftdata-0.1.2.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cryptohftdata-0.1.2-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file cryptohftdata-0.1.2.tar.gz.

File metadata

  • Download URL: cryptohftdata-0.1.2.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cryptohftdata-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0c72abdee7ffea999d30d35669fe3b5f28ad99812a76fd9944ab503b91d29d54
MD5 812b8353baa1e73c9587c5f61cfe4d1e
BLAKE2b-256 9b14b52c1018d39d703a59a98d2fc50d5d3677926500148a4daa3171612fcf77

See more details on using hashes here.

File details

Details for the file cryptohftdata-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cryptohftdata-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cryptohftdata-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 da7d827512482c6fc423fbb84febec6c7770ec016ef0bc687fdf34f7ac28d7ac
MD5 7796dee49aa3f3375857d159e610bc0b
BLAKE2b-256 f1903030a0a9879f4c172d94c1adddbe64ca78abb77a89181e8cfae8cb29fc36

See more details on using hashes here.

Supported by

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