Metadata-Version: 2.5
Name: datakodo
Version: 0.1.0
Summary: Unified market data library — one interface, many providers
Project-URL: Homepage, https://github.com/aineurog/datakodo
Project-URL: Repository, https://github.com/aineurog/datakodo
Project-URL: Issues, https://github.com/aineurog/datakodo/issues
Project-URL: Changelog, https://github.com/aineurog/datakodo/blob/main/CHANGELOG.md
Author: Qaisar Jalil
License: MIT
License-File: LICENSE
Keywords: batch-fetch,binance,crypto,equities,forex,fundamentals,market-data,ohlcv,resampling,trading,websocket
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.11
Requires-Dist: pandas>=2.0
Requires-Dist: polars>=0.20
Requires-Dist: pyarrow>=14.0
Requires-Dist: pydantic-settings>=2.0
Requires-Dist: pydantic>=2.0
Requires-Dist: python-dotenv>=1.0
Provides-Extra: all
Requires-Dist: alpaca-py>=0.20; extra == 'all'
Requires-Dist: exchange-calendars>=4.0; extra == 'all'
Requires-Dist: ib-insync>=0.9; extra == 'all'
Requires-Dist: massive>=1.0; extra == 'all'
Requires-Dist: metatrader5; (sys_platform == 'win32') and extra == 'all'
Requires-Dist: python-binance>=1.0; extra == 'all'
Provides-Extra: alpaca
Requires-Dist: alpaca-py>=0.20; extra == 'alpaca'
Provides-Extra: binance
Requires-Dist: python-binance>=1.0; extra == 'binance'
Provides-Extra: calendar
Requires-Dist: exchange-calendars>=4.0; extra == 'calendar'
Provides-Extra: dev
Requires-Dist: exchange-calendars>=4.0; extra == 'dev'
Requires-Dist: hypothesis>=6.100; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Provides-Extra: ibkr
Requires-Dist: ib-insync>=0.9; extra == 'ibkr'
Provides-Extra: massive
Requires-Dist: massive>=1.0; extra == 'massive'
Provides-Extra: mt5
Requires-Dist: metatrader5; (sys_platform == 'win32') and extra == 'mt5'
Description-Content-Type: text/markdown

# DataKodo

Unified market data adapter library for accessing financial exchange data
through a common interface.

<!-- Badges: placeholders — update the URLs once the package is published and CI is public. -->
[![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue)](https://www.python.org/)
[![PyPI version](https://img.shields.io/pypi/v/datakodo.svg)](https://pypi.org/project/datakodo/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/aineurog/datakodo/blob/main/LICENSE)
[![Build status](https://img.shields.io/badge/build-passing-brightgreen.svg)](#)

DataKodo gives you a single, consistent way to work with market data from
different exchanges. Instead of learning each exchange's API, you use one
interface and let DataKodo handle the details — the same code works whether
your data comes from Binance today or another provider tomorrow.

## Features

- **One interface, many providers.** An adapter architecture means every
  exchange is reached through the same API, and switching providers is a
  one-line change.
- **Historical and real-time data.** Fetch OHLCV candles, trade ticks, and
  order book snapshots over REST, and stream live trades and order books
  over WebSocket.
- **Canonical schemas.** Every provider returns data in the same shape,
  so your analysis code never depends on a specific exchange.
- **Closed-data guarantees.** Fetches use a half-open `[start, end)` window
  and return only fully closed candles by default, so historical data stays
  consistent.
- **Session-aware calendars.** Trading sessions, holidays, half days, DST,
  and market-specific rollovers (for example forex's 17:00 New York close)
  drive resampling and gap detection.
- **Rich instrument metadata.** Volume semantics, contract multipliers, tick
  sizes, price precision, expiry and roll rules, capability flags, and
  adjustment state travel with the data.
- **Explicit adjustments.** Split and dividend adjustment is a separate
  pipeline step that returns cumulative price and volume factors, so raw data
  is always reconstructible.
- **Continuous futures.** Stitch contracts on a calendar roll schedule with
  ratio or difference back-adjustment, recording every roll.
- **Built-in rate limiting.** Requests are rate-limited automatically, with
  retry and exponential backoff.
- **Flexible output.** Return data as pandas (default), polars, or Arrow.

## Installation

Install DataKodo with support for your provider:

```bash
pip install datakodo[binance]    # Binance spot + USD-M futures
pip install datakodo[alpaca]     # Alpaca: US equities + crypto spot
pip install datakodo[mt5]        # MetaTrader 5 terminal (Windows)
pip install datakodo[massive]    # Massive.com (ex-Polygon.io): stocks, crypto, forex, indices, options
pip install datakodo[calendar]   # exchange_calendars: real exchange holidays and half days
```

## Quick Start

```python
from datetime import UTC, datetime

from datakodo import Client

client = Client("binance")
df = client.fetch_ohlcv(
    "BTCUSDT",
    "1h",
    start=datetime(2026, 8, 1, tzinfo=UTC),
    end=datetime.now(UTC),
)
print(df)
```

The same `Client` facade works for MetaTrader 5 (requires a running terminal):

```python
from datetime import UTC, datetime

from datakodo import Client

with Client("mt5") as client:
    df = client.fetch_ohlcv(
        "EURUSD",
        "1h",
        start=datetime(2026, 8, 1, tzinfo=UTC),
        end=datetime.now(UTC),
    )
print(df)
```

Public market data needs no API key. Provider usage guides:
- [Binance](https://github.com/aineurog/datakodo/blob/main/docs/binance.md)
- [Alpaca](https://github.com/aineurog/datakodo/blob/main/docs/alpaca.md)
- [MetaTrader 5](https://github.com/aineurog/datakodo/blob/main/docs/mt5.md)
- [Massive](https://github.com/aineurog/datakodo/blob/main/docs/massive.md)

## Supported Providers

| Provider | Markets | Status |
| --- | --- | --- |
| Binance | Spot, USD-M perpetual futures | Implemented |
| MetaTrader 5 | Forex, CFDs, metals, indices, futures (local Windows terminal) | Implemented |
| Massive | Stocks, crypto, forex, indices, options, futures (Massive.com API key required) | Implemented |
| Alpaca | US equities, crypto spot (Alpaca API key required) | Implemented |
| Bybit and others | — | Planned |

## Documentation

- [Usage guide — Binance](https://github.com/aineurog/datakodo/blob/main/docs/binance.md) — installation, configuration, and examples.
- [Usage guide — Alpaca](https://github.com/aineurog/datakodo/blob/main/docs/alpaca.md) — installation, configuration, and examples.
- [Usage guide — MetaTrader 5](https://github.com/aineurog/datakodo/blob/main/docs/mt5.md) — installation, configuration, and examples.
- [Usage guide — Massive](https://github.com/aineurog/datakodo/blob/main/docs/massive.md) — installation, configuration, and examples.

## License

Distributed under the [MIT License](https://github.com/aineurog/datakodo/blob/main/LICENSE).
