Skip to main content

Python library for acquiring, storing, transforming, and validating market data

Project description

qldata

Modern Python library for cryptocurrency market data

Acquire, store, transform, and validate market data with a beautiful, Pythonic API

Python 3.10+ License: MIT Version Documentation

DocumentationExamplesChangelog


✨ Features

🎯 Fluent API Design

import qldata as qd

# One-liner to get clean data
df = qd.data("BTCUSDT", source="binance")
    .last(30)
    .resolution("1h")
    .clean()
    .get()

📡 Real-Time Streaming

# Live data with resilience built-in
stream = qd.stream(["BTCUSDT", "ETHUSDT"])
    .resolution("tick")
    .on_data(handle_tick)
    .get(start=True)

🔄 Data Transforms

# Clean, fill, and resample
clean_df = (
    qd.data("BTCUSDT", source="binance")
    .last(7)
    .resolution("1m")
    .clean(remove_outliers=True)
    .fill_forward()
    .resample("1h")
    .get()
)

🛡️ Built for Reliability

# Built-in monitoring & alerts
from qldata.monitoring import (
    DataQualityMonitor,
    AlertManager
)

monitor = DataQualityMonitor()
alerts = AlertManager()
alerts.on_stale_data(send_alert)

🚀 Quick Start

Installation

# Full installation (recommended)
pip install qldata

# Minimal (core only, no broker dependencies)
pip install qldata[minimal]

# Specific exchanges
pip install qldata[binance]  # Binance only
pip install qldata[bybit]    # Bybit only

Your First Query

import qldata as qd

# Fetch the last 30 days of hourly BTC data from Binance
df = qd.data("BTCUSDT", source="binance", category="spot") \
    .last(30) \
    .resolution("1h") \
    .get()

print(df.head())
#                            open      high       low     close      volume
# timestamp                                                                 
# 2024-11-05 00:00:00  69500.00  69750.00  69400.00  69600.00  1250.5432
# 2024-11-05 01:00:00  69600.00  69800.00  69550.00  69750.00  1180.2341
# ...

Live Streaming

import qldata as qd

def handle_data(df):
    """Process incoming tick data."""
    if not df.empty:
        latest = df.iloc[-1]
        print(f"[{latest['symbol']}] Price: {latest['price']}")

# Start streaming with auto-reconnect
stream = qd.stream(["BTCUSDT", "ETHUSDT"], source="binance") \
    .resolution("tick") \
    .on_data(handle_data) \
    .get(start=True)

# Stream runs until you stop it
# stream.stop()

📦 Supported Exchanges

Exchange Spot Perpetuals Streaming Status
Binance ✅ (USDM) Stable
Bybit ✅ (Linear) Stable

🧰 Core Capabilities

Historical Data

  • Fluent query builder for intuitive data fetching
  • Multi-symbol parallel downloads with configurable workers
  • Automatic pagination for large date ranges
  • Built-in caching for repeated queries

Live Streaming

  • WebSocket connections with auto-reconnect
  • Rate limit management to respect exchange limits
  • Sequence tracking to detect missed messages
  • Time synchronization for accurate timestamps

Data Quality

  • Adaptive cleaning that detects data type (OHLCV, tick, etc.)
  • Outlier detection using statistical methods
  • Gap analysis to find missing data periods
  • Validation rules for data integrity

Monitoring & Resilience

  • Latency tracking (P50, P95, P99)
  • Throughput monitoring for data rates
  • Stale data detection with configurable thresholds
  • Alert callbacks for production systems

📚 Documentation

Comprehensive documentation is available at zentch-q.github.io/qldata-docs


🏗️ Architecture Overview

qldata
├── api/            # Unified API layer (qd.data, qd.stream)
├── adapters/       # Exchange-specific implementations
│   └── brokers/    # Binance, Bybit adapters
├── models/         # Data models (Bar, Tick, OrderBook, etc.)
├── transforms/     # Data cleaning and transformation
├── validation/     # Data quality checks and rules
├── resilience/     # Connection management, rate limiting
├── monitoring/     # Metrics, alerts, health checks
└── stores/         # Storage backends (Parquet, DuckDB)

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.


📄 License

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


Made with ❤️ by ZENTCH-Q

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

qldata-0.3.0.tar.gz (103.5 kB view details)

Uploaded Source

Built Distribution

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

qldata-0.3.0-py3-none-any.whl (137.6 kB view details)

Uploaded Python 3

File details

Details for the file qldata-0.3.0.tar.gz.

File metadata

  • Download URL: qldata-0.3.0.tar.gz
  • Upload date:
  • Size: 103.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for qldata-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d399f54cba6d622392314e75c226ad5c92577ea148c6f9b2290042ed96be6250
MD5 632e6382cc082f6c388280d137fdb51d
BLAKE2b-256 aa08a21b995d54ce0072bbe2d464fa9a44c6e7c400662677f40bdc20dacdeeca

See more details on using hashes here.

File details

Details for the file qldata-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: qldata-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 137.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for qldata-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e1cafed0d6397ea86d08ba4c83265e2f1f102dea4116d0d71039f698ed7e9f5
MD5 2e6b612526ef4091da6dfb76749edd18
BLAKE2b-256 708d0fe3688d9aa4e3faffe0c3303ed5a9020ae3d29da947d729ef328e59d91d

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