klines-okx
收藏资源简介:
OKX USDT永续合约OHLCV K线数据集是一个用于金融时间序列分析和回测的开源数据集。它提供了OKX交易所USDT保证金永续期货合约的历史OHLCV(开盘价、最高价、最低价、收盘价、成交量)蜡烛图(K线)数据。该数据集旨在支持无幸存者偏差的点位回测,因此特意包含了已下架的交易对数据。数据以ZSTD压缩的Parquet格式存储,按时间框架(如15分钟、1小时、4小时、1天,未来计划增加5分钟、3分钟和1分钟)和交易对组织文件路径。每个OHLCV数据文件包含date(UTC蜡烛图开盘时间戳)、open、high、low、close、volume等字段。此外,对于许多交易对,还提供了单独的mark价格和funding_rate(资金费率)时间序列文件。数据集规模属于1B<n<10B级别,目标覆盖约408个交易对(包括已下架的),历史数据从各合约上市时间(主要为2020-2021年起)至今。该数据集适用于时间序列预测、加密货币市场分析、量化交易策略开发和回测等任务。需要注意的是,该数据集目前仍在积极构建中,覆盖范围不完全,数据按原样提供,不保证准确性或完整性。
The OKX USDT-margined perpetual contract OHLCV candlestick dataset is an open-source dataset for financial time series analysis and backtesting. It provides historical OHLCV (Open, High, Low, Close, Volume) candlestick (K-line) data for USDT-margined perpetual futures contracts traded on the OKX exchange. This dataset is designed to support survivor-bias-free point-in-time backtesting, so it intentionally includes data for delisted trading pairs. The data is stored in ZSTD-compressed Parquet format, with file paths organized by time frame (e.g., 15 minutes, 1 hour, 4 hours, 1 day; 5-minute, 3-minute, and 1-minute time frames are planned for future addition) and trading pairs. Each OHLCV data file contains fields including date (UTC timestamp of the candlestick opening time), open, high, low, close, and volume. In addition, separate time series files for mark price and funding rate are provided for many trading pairs. The dataset has a scale between 1 billion and 10 billion data points, targeting coverage of approximately 408 trading pairs (including delisted ones). Historical data spans from the launch dates of each contract (mainly starting from 2020-2021) to the present. This dataset is applicable to tasks such as time series forecasting, cryptocurrency market analysis, quantitative trading strategy development and backtesting. It should be noted that this dataset is still under active development, with incomplete coverage. The data is provided as-is, without any guarantee of accuracy or completeness.
数据集概要
- 名称:OKX USDT Perpetual OHLCV Klines
- 许可证:MIT
- 任务类型:时间序列预测
- 语言:英语
- 标签:加密货币、金融、OHLCV(开盘、最高、最低、收盘、成交量)、K线数据、OKX交易所、永续合约、交易
- 数据集规模:10亿至100亿行
- 数据集主页:https://huggingface.co/datasets/rogerdehe/klines-okx
数据内容
- 数据来源:OKX交易所的USDT保证金永续合约
- 数据格式:Zstd压缩的Parquet文件
- 包含信息:
- 历史OHLCV(开盘价、最高价、最低价、收盘价、成交量)K线数据
- 标记价格(mark price)序列
- 资金费率(funding_rate)序列
- 特色:包含已下架的交易对,支持无幸存者偏差的回测研究
覆盖范围
| 项目 | 详情 |
|---|---|
| 交易对 | 约408个(含已下架),持续建设中 |
| 时间周期 | 当前填充:15分钟、1小时、4小时、1天;后续规划:5分钟、3分钟、1分钟 |
| 历史跨度 | 从每个合约上线时间(主要是2020–2021年起)至今 |
| 附加数据 | 多个交易对包含标记价格和资金费率序列 |
文件结构
- 路径格式:
futures/{时间周期}/{交易对}.parquet - 交易对命名规则:
BASE_USDT_USDT(USDT保证金永续合约) - 示例文件:
futures/1d/BTC_USDT_USDT.parquet(OHLCV数据)futures/1h/BTC_USDT_USDT-mark.parquet(标记价格)futures/8h/BTC_USDT_USDT-funding_rate.parquet(资金费率)
- OHLCV Parquet列结构:
date(UTC蜡烛图开盘时间)、open、high、low、close、volume
使用说明
- 数据加载方式:通过
huggingface_hub库的hf_hub_download函数直接下载Parquet文件,再用pandas.read_parquet读取 - 注意事项:
- 时间戳为UTC时间
- 不同交易对的历史覆盖长度不同,数据集仍在填充中
- Hugging Face数据集查看器已禁用(因自定义按交易对布局),需直接加载文件
- 数据仅供研究使用,按原样提供,不保证准确性或完整性




