Skip to main content

Shared datastore utilities for GroAI.fi — Binance market data downloading, parquet storage, and trading infrastructure

Project description

groai-fi-datastore-shared

PyPI version Python 3.9+ License: Apache 2.0 CI

Shared datastore utilities for GroAI.fi — Binance market data downloading, partitioned Parquet storage, order execution, and backtesting infrastructure.


Features

  • Market Data Downloading — Incremental Binance OHLCV download with automatic catch-up from where you left off
  • Parquet Storage — Hive-partitioned Parquet files (exchange=X/symbol=Y/part.N.parquet) powered by Dask
  • File Locking — Safe concurrent writes via .write.lock file with stale-lock detection
  • Order ExecutionBinanceOrder, BinanceClient with spot and margin support
  • BacktestingBacktestOrder, BacktestOrderData for strategy simulation
  • CLI Tools — Three ready-to-use command-line scripts for data management

Installation

# Using pip
pip install groai-fi-datastore-shared

# Using uv (recommended)
uv add groai-fi-datastore-shared

Environment Variables

The following environment variables are used across modules:

Variable Required Description
BINANCE_API_KEY Yes (trading/download) Your Binance API key
BINANCE_API_SECRET Yes (trading/download) Your Binance API secret
BINANCE_API_KEY_TEST No Testnet API key
BINANCE_API_SECRET_TEST No Testnet API secret
SEND_MAIL_RECEIVER No Email address for trade alerts

Create a .env file in your project root and load it with python-dotenv or export variables in your shell.


CLI Usage

Download price data

binance-download-price \
  --symbol BTCUSDT \
  --tframe 1m \
  --path /absolute/path/to/prices_v3.parquet \
  --start_date 2024/01/01

Merge / compact parquet files

binance-merge-parquet \
  --exchange Binance \
  --symbol BTCUSDT \
  --path /absolute/path/to/prices_v3.parquet \
  --interval_base 1m

Auto-update all symbols

binance-auto-update \
  --exchange-dir /absolute/path/to/prices_v3.parquet/exchange=Binance \
  --price-root /absolute/path/to/prices_v3.parquet \
  --tframe 1m

Python API

# Market data downloading
from groai_fi_datastore_shared.Binance import BinanceMarketDataDownloader
from datetime import datetime

logger = ...  # your logger

BinanceMarketDataDownloader.catchup_price_binance(
    symbol="BTCUSDT",
    kline_tframe="1m",
    default_download_start_date=datetime(2024, 1, 1),
    price_root_dir="/data/prices_v3.parquet",
    logger=logger,
)

# Reading config from environment
from groai_fi_datastore_shared.Binance.config import BinanceConfig
config = BinanceConfig.from_env()

# Trading client
from groai_fi_datastore_shared.Binance import BinanceClient
client = BinanceClient(config)

Development

# Clone
git clone https://github.com/groai-fi/datastore.shared.git
cd datastore.shared

# Install with dev extras
make install-dev

# Run tests
make test

# Lint
make lint

Publishing

# Build wheel + sdist
make build

# Publish to PyPI (requires UV_PUBLISH_TOKEN in env)
make publish

# Publish to TestPyPI first
make publish-test

To release a new version:

  1. Bump the version field in pyproject.toml
  2. Commit and push
  3. Tag: git tag v0.2.0 && git push origin v0.2.0
  4. GitHub Actions will automatically build and publish to PyPI

License

Apache License 2.0

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

groai_fi_datastore_shared-0.1.0.tar.gz (73.1 kB view details)

Uploaded Source

Built Distribution

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

groai_fi_datastore_shared-0.1.0-py3-none-any.whl (85.6 kB view details)

Uploaded Python 3

File details

Details for the file groai_fi_datastore_shared-0.1.0.tar.gz.

File metadata

  • Download URL: groai_fi_datastore_shared-0.1.0.tar.gz
  • Upload date:
  • Size: 73.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for groai_fi_datastore_shared-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64e935d7f99228d271ec786b3533e189b2b5fe4f1515537f43692aed5b203acd
MD5 85fdbe3e483c13299a0d1c101460f682
BLAKE2b-256 43c8910c1bd8af57b24683ee7d2dbaa0bf51659351636a666de86eb73dd19467

See more details on using hashes here.

File details

Details for the file groai_fi_datastore_shared-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: groai_fi_datastore_shared-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 85.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for groai_fi_datastore_shared-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d398b074e627f3146513acc211d63c90b9a209bc99dc5258f7b5df350e6dc7c
MD5 ab300b1eee83ae1e5689498396d1b142
BLAKE2b-256 6b0953eda8fd76f3065937a3fd7d50cf0ad147b95768fdaf4aaeaa90c2b8b3a3

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