Skip to content

tigeratgithub/ib_history

Repository files navigation

ib_history

用于获取 MNQ / MGC 历史 K 线数据。由于 IBKR 不支持连续主力合约按时间段拉取,本项目通过单月合约分段获取并落库,供回测使用。

快速开始

1. 环境

  • 使用 uv 管理虚拟环境,虚拟环境位于 .venv

2. 图表查看

使用脚本启动(已包含 PYTHONPATH):

.\run_chart.ps1

如需手动运行:

$env:PYTHONPATH="$pwd\src;$pwd\lightweight-charts-python"
uv run --python .\.venv\Scripts\python.exe -m ib_history.cli chart --db data/ib_history.sqlite --symbol MNQ --bar 3m

说明

  • 数据库存储:bars_{symbol}_{bar}
  • 失败日志:fetch_failures
  • 图表:基于 lightweight-charts-python,支持标的/周期切换与动态加载

About

获取MNQ和MGC的历史K线数据,因为IBKR不支持连续主力期货的时间按段获取,所以使用各月份期货获取数据,用于回测

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors