Micro-sheep / Micro-sheep/efinance

期货k线分钟级别历史数据不准确

Open
#222 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.1k
Forks
755
PR merge metrics
No merged PRs in 30d

Description

系统设置:
- OS: Mac Silicon Sequoia 15.6.1
- Python: 3.13.5
- efinance: 0.5.5.2

情况描述:
- 5-60分钟线数据远端数据错误(近段正确),前者OHLC价格大幅偏离实际值。目测只有最近2小时的分钟数据准确?以铁矿石(114.im) 为例:
```
future_code = "114.im"
df_min = ef.futures.get_quote_history(future_code, klt=1)
df_5m = ef.futures.get_quote_history(future_code, klt=5)
df_15min = ef.futures.get_quote_history(future_code, klt=15)
df_hr = ef.futures.get_quote_history(future_code, klt=60)
```

铁矿石:
- 1 min head (正确✅):
| 期货名称 | 期货代码 | 日期 | 开盘 | 收盘 | 最高 | 最低 | 成交量 | 成交额 | 振幅 | 涨跌幅 | 涨跌额 | 换手率 |
|------------|----------|-------------------|-------|-------|-------|-------|--------|--------------|------|--------|--------|--------|
| 铁矿石主连 | im | 2025-08-29 21:01 | 787.0 | 783.5 | 787.0 | 781.5 | 14123 | 1.106517e+09 | 0.70 | -0.44 | -3.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 21:02 | 784.0 | 783.5 | 784.0 | 782.0 | 6363 | 4.981766e+08 | 0.26 | 0.00 | 0.0 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 21:03 | 783.0 | 783.0 | 784.0 | 783.0 | 2542 | 1.991469e+08 | 0.13 | -0.06 | -0.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 21:04 | 782.5 | 782.5 | 783.0 | 782.0 | 2601 | 2.035488e+08 | 0.13 | -0.06 | -0.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 21:05 | 782.5 | 782.5 | 783.0 | 782.5 | 933 | 7.303440e+07 | 0.06 | 0.00 | 0.0 | 0.0 |
- 1 min tail (正确✅):
| 期货名称 | 期货代码 | 日期 | 开盘 | 收盘 | 最高 | 最低 | 成交量 | 成交额 | 振幅 | 涨跌幅 | 涨跌额 | 换手率 |
|------------|----------|-------------------|-------|-------|-------|-------|--------|---------------|------|--------|--------|--------|
| 铁矿石主连 | im | 2025-08-29 22:56 | 776.5 | 778.0 | 778.0 | 776.5 | 2579 | 200512650.0 | 0.19 | 0.19 | 1.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:57 | 777.5 | 776.5 | 778.0 | 776.5 | 1951 | 151617350.0 | 0.19 | -0.19 | -1.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:58 | 776.5 | 776.0 | 777.0 | 776.0 | 2243 | 174129750.0 | 0.13 | -0.06 | -0.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:59 | 776.0 | 776.5 | 777.0 | 776.0 | 1899 | 147451200.0 | 0.13 | 0.06 | 0.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 23:00 | 776.5 | 775.5 | 777.0 | 775.5 | 3395 | 263543500.0 | 0.19 | -0.13 | -1.0 | 0.0 |
- 5 min head (价格错误❌):
| 期货名称 | 期货代码 | 日期 | 开盘 | 收盘 | 最高 | 最低 | 成交量 | 成交额 | 振幅 | 涨跌幅 | 涨跌额 | 换手率 |
|------------|----------|-------------------|--------------|--------------|--------------|--------------|--------|--------------|--------|-------------|-------------|--------|
| 铁矿石主连 | im | 2025-07-31 21:05 | 11452416.0 | 11452661.8 | 11453153.3 | 11452252.2 | 16891 | 1.321423e+09 | 112.92 | 1435070.63 | 11451864.0 | 0.0 |
| 铁矿石主连 | im | 2025-07-31 21:10 | 11452661.8 | 11452579.8 | 11452989.4 | 11452579.8 | 5768 | 4.512580e+08 | 0.00 | 0.00 | -82.0 | 0.0 |
| 铁矿石主连 | im | 2025-07-31 21:15 | 11452661.8 | 11452661.8 | 11452989.4 | 11452579.8 | 5607 | 4.387472e+08 | 0.00 | 0.00 | 82.0 | 0.0 |
| 铁矿石主连 | im | 2025-07-31 21:20 | 11452579.8 | 11452579.8 | 11452743.7 | 11452497.9 | 3455 | 2.698710e+08 | 0.00 | 0.00 | -82.0 | 0.0 |
| 铁矿石主连 | im | 2025-07-31 21:25 | 11452497.9 | 11452497.9 | 11452661.8 | 11452416.0 | 2660 | 2.076625e+08 | 0.00 | 0.00 | -81.9 | 0.0 |
- 5min tail (正确✅):
| 期货名称 | 期货代码 | 日期 | 开盘 | 收盘 | 最高 | 最低 | 成交量 | 成交额 | 振幅 | 涨跌幅 | 涨跌额 | 换手率 |
|------------|----------|-------------------|-------|-------|-------|-------|--------|--------------|------|--------|--------|--------|
| 铁矿石主连 | im | 2025-08-29 22:40 | 781.5 | 780.5 | 781.5 | 780.5 | 1422 | 1.110589e+08 | 0.13 | -0.13 | -1.0 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:45 | 781.0 | 780.5 | 781.5 | 780.0 | 1340 | 1.046199e+08 | 0.19 | 0.00 | 0.0 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:50 | 780.5 | 780.0 | 781.0 | 780.0 | 1739 | 1.357130e+08 | 0.13 | -0.06 | -0.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:55 | 780.0 | 776.5 | 780.5 | 776.5 | 13433 | 1.045507e+09 | 0.51 | -0.45 | -3.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 23:00 | 776.5 | 775.5 | 778.0 | 775.5 | 12067 | 9.372544e+08 | 0.32 | -0.13 | -1.0 | 0.0 |
- 15 min head (价格错误❌):
| 期货名称 | 期货代码 | 日期 | 开盘 | 收盘 | 最高 | 最低 | 成交量 | 成交额 | 振幅 | 涨跌幅 | 涨跌额 | 换手率 |
|------------|----------|-------------------|--------------|--------------|--------------|--------------|--------|--------------|--------|-------------|-------------|--------|
| 铁矿石主连 | im | 2025-07-31 21:15 | 11452416.0 | 11452661.8 | 11453153.3 | 11452252.2 | 28266 | 2.211428e+09 | 112.92 | 1435070.63 | 11451864.0 | 0.0 |
| 铁矿石主连 | im | 2025-07-31 21:30 | 11452579.8 | 11452334.1 | 11452743.7 | 11452334.1 | 9133 | 7.129516e+08 | 0.00 | 0.00 | -327.7 | 0.0 |
| 铁矿石主连 | im | 2025-07-31 21:45 | 11452334.1 | 11452825.6 | 11452907.5 | 11451842.6 | 18192 | 1.418351e+09 | 0.01 | 0.00 | 491.5 | 0.0 |
| 铁矿石主连 | im | 2025-07-31 22:00 | 11452825.6 | 11452989.4 | 11452989.4 | 11452661.8 | 4716 | 3.688934e+08 | 0.00 | 0.00 | 163.8 | 0.0 |
| 铁矿石主连 | im | 2025-07-31 22:15 | 11452989.4 | 11453235.2 | 11453317.1 | 11452825.6 | 10243 | 8.031509e+08 | 0.00 | 0.00 | 245.8 | 0.0 |
- 15 min tail (正确✅):
| 期货名称 | 期货代码 | 日期 | 开盘 | 收盘 | 最高 | 最低 | 成交量 | 成交额 | 振幅 | 涨跌幅 | 涨跌额 | 换手率 |
|------------|----------|-------------------|-------|-------|-------|-------|--------|--------------|------|--------|--------|--------|
| 铁矿石主连 | im | 2025-08-29 22:00 | 780.5 | 779.5 | 781.5 | 779.5 | 7861 | 6.134036e+08 | 0.26 | -0.13 | -1.0 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:15 | 780.0 | 779.0 | 780.5 | 778.0 | 12314 | 9.596680e+08 | 0.32 | -0.06 | -0.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:30 | 779.0 | 781.5 | 781.5 | 778.0 | 10781 | 8.409174e+08 | 0.45 | 0.32 | 2.5 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:45 | 781.0 | 780.5 | 782.5 | 780.0 | 7133 | 5.572956e+08 | 0.32 | -0.13 | -1.0 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 23:00 | 780.5 | 775.5 | 781.0 | 775.5 | 27239 | 2.118475e+09 | 0.70 | -0.64 | -5.0 | 0.0 |
- 60 min head (价格错误❌):
| 期货名称 | 期货代码 | 日期 | 开盘 | 收盘 | 最高 | 最低 | 成交量 | 成交额 | 振幅 | 涨跌幅 | 涨跌额 | 换手率 |
|------------|----------|-------------------|--------------|--------------|--------------|--------------|--------|--------------|--------|-------------|-------------|--------|
| 铁矿石主连 | im | 2025-07-31 22:00 | 11452416.0 | 11452989.4 | 11453153.3 | 11451842.6 | 60307 | 4.711624e+09 | 164.25 | 1435111.75 | 11452191.0 | 0.0 |
| 铁矿石主连 | im | 2025-07-31 23:00 | 11452989.4 | 11453481.0 | 11453481.0 | 11452825.6 | 32018 | 2.513125e+09 | 0.01 | 0.00 | 491.6 | 0.0 |
| 铁矿石主连 | im | 2025-08-01 10:00 | 11453481.0 | 11453808.6 | 11453972.5 | 11452989.4 | 35621 | 2.798493e+09 | 0.01 | 0.00 | 327.6 | 0.0 |
| 铁矿石主连 | im | 2025-08-01 11:15 | 11453808.6 | 11453808.6 | 11454136.3 | 11453153.3 | 44211 | 3.484265e+09 | 0.01 | 0.00 | 0.0 | 0.0 |
| 铁矿石主连 | im | 2025-08-01 14:15 | 11453808.6 | 11453644.8 | 11454054.4 | 11452989.4 | 49255 | 3.873717e+09 | 0.01 | 0.00 | -163.8 | 0.0 |
- 60 min tail (价格错误❌):
| 期货名称 | 期货代码 | 日期 | 开盘 | 收盘 | 最高 | 最低 | 成交量 | 成交额 | 振幅 | 涨跌幅 | 涨跌额 | 换手率 |
|------------|----------|-------------------|--------------|--------------|--------------|--------------|--------|--------------|------|--------|--------|--------|
| 铁矿石主连 | im | 2025-08-29 11:15 | 11453399.0 | 11453644.8 | 11453726.7 | 11453235.2 | 22525 | 1.772368e+09 | 0.00 | 0.00 | 327.7 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 14:15 | 11453644.8 | 11453644.8 | 11454054.4 | 11453399.0 | 30026 | 2.366331e+09 | 0.01 | 0.00 | 0.0 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 15:00 | 11453726.7 | 11453644.8 | 11453808.6 | 11453235.2 | 33569 | 2.640104e+09 | 0.01 | 0.00 | 0.0 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 22:00 | 787.0 | 779.5 | 787.0 | 779.5 | 78541 | 6.140551e+09 | 0.95 | -1.02 | -8.0 | 0.0 |
| 铁矿石主连 | im | 2025-08-29 23:00 | 780.0 | 775.5 | 782.5 | 775.5 | 57467 | 4.476356e+09 | 0.90 | -0.51 | -4.0 | 0.0 |

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reported Python examples for futures code 114.im with klt values 1, 5, 15, and 60, then compare historical OHLC values with the demonstrated recent results. Trace the futures quote-history retrieval and transformation path; done means older intraday records no longer contain the large price deviations shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.