Metadata-Version: 2.4
Name: drip-exchange-klines
Version: 0.3.0
Summary: Official REST K-line adapters for OKX and Bitget
Keywords: bitget,kline,market-data,ohlcv,okx
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: <3.13,>=3.12
Requires-Dist: requests<3,>=2.32
Description-Content-Type: text/markdown

# drip-exchange-klines

OKX 和 Bitget 的公开 REST K 线适配器。包本身不依赖 CCXT，不读取交易账户凭据，也不包含调度或数据库写入逻辑。

```bash
pip install drip-exchange-klines
```

```python
from drip_exchange_klines import create_adapter

adapter = create_adapter("okx", "swap")
try:
    bars = adapter.fetch_page(
        symbol="BTCUSDT",
        exchange_symbol="BTC-USDT-SWAP",
        timeframe="5m",
        since_ms=0,
        until_ms=600_000,
        limit=300,
    )
finally:
    adapter.close()
```

适配器统一输出 `exchange`、`market_type`、`symbol`、`exchange_symbol`、`timeframe`、`ts`、`open`、`high`、`low`、`close`、`volume` 和 `confirm`。`ts` 是 UTC 毫秒开盘时间戳，`volume` 是基础资产成交量。

`proxy_url` 是可选参数。未传入时不会设置 HTTP/HTTPS 代理，也不会读取系统代理；需要代理时显式传入 `create_adapter(..., proxy_url="http://127.0.0.1:10808")`。

支持的交易所为 `okx` 和 `bitget`，市场类型为 `spot` 和 `swap`。该包只调用无需鉴权的行情 REST API；各交易所的可查询历史范围、频率限制和 K 线粒度以其官方文档为准：[OKX](https://www.okx.com/docs-v5/en/)、[Bitget 现货](https://www.bitget.com/api-doc/spot/market/Get-Candle-Data)、[Bitget 合约](https://www.bitget.com/api-doc/contract/market/Get-Candle-Data)。
