massive-com / massive-com/client-python

get daily k line data is wrong

Open
#1,007 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.5k
Forks
362
PR merge metrics
No merged PRs in 30d

Description

from massive import RESTClient
from datetime import datetime, timezone, timedelta

1. 初始化客户端

client = RESTClient("xxxxxxxx")

2. 获取数据

aggs = []
for a in client.list_aggs(
"NVDA",
1,
"day",
"2026-02-13",
"2026-03-14",
limit=50000,
):
aggs.append(a)

3. 打印每一条详细数据

print(f"共获取到 {len(aggs)} 条 NVDA 1分钟K线数据 (日期: 2026-03-12)")
print("=" * 80)

if len(aggs) > 0:
for i, agg in enumerate(aggs):
# 将时间戳(毫秒)转换为可读的日期时间格式
# 1. 将时间戳转换为感知型datetime对象 (UTC时区)
dt_utc = datetime.fromtimestamp(agg.timestamp / 1000, tz=timezone.utc)

    # 2. 转换为北京时间 (UTC+8)
    beijing_tz = timezone(timedelta(hours=8))
    dt_beijing = dt_utc.astimezone(beijing_tz)
    
    # 3. 格式化输出
    beijing_str = dt_beijing.strftime('%Y-%m-%d %H:%M:%S')
    utc_str = dt_utc.strftime('%Y-%m-%d %H:%M:%S')
    
    print(f"第 {i+1:3d} 条数据 | UTC时间: {utc_str} | 北京时间: {beijing_str}")
    
    print(f"  - 开盘价 (open): {agg.open}")
    print(f"  - 最高价 (high): {agg.high}")
    print(f"  - 最低价 (low): {agg.low}")
    print(f"  - 收盘价 (close): {agg.close}")
    print(f"  - 成交量 (volume): {agg.volume}")
    print(f"  - 成交量加权平均价 (vwap): {agg.vwap}")
    print(f"  - 聚合窗口内交易笔数 (transactions): {agg.transactions}")
    print(f"  - 是否为场外交易 (otc): {agg.otc}")
    print(f"  - 原始时间戳 (timestamp, 毫秒): {agg.timestamp}")
    print("-" * 80)

else:
print("未获取到任何数据。")

第 1 条数据 | UTC时间: 2026-02-13 05:00:00 | 北京时间: 2026-02-13 13:00:00

  • 开盘价 (open): 187.475
  • 最高价 (high): 187.5
  • 最低价 (low): 181.59
  • 收盘价 (close): 182.81
  • 成交量 (volume): 161888021.0
  • 成交量加权平均价 (vwap): 183.6369
  • 聚合窗口内交易笔数 (transactions): 2577092
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1770958800000

第 2 条数据 | UTC时间: 2026-02-17 05:00:00 | 北京时间: 2026-02-17 13:00:00

  • 开盘价 (open): 181.75
  • 最高价 (high): 187.15
  • 最低价 (low): 179.18
  • 收盘价 (close): 184.97
  • 成交量 (volume): 162276860.0
  • 成交量加权平均价 (vwap): 183.6291
  • 聚合窗口内交易笔数 (transactions): 2506157
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1771304400000

第 3 条数据 | UTC时间: 2026-02-18 05:00:00 | 北京时间: 2026-02-18 13:00:00

  • 开盘价 (open): 188.75
  • 最高价 (high): 190.37
  • 最低价 (low): 186.76
  • 收盘价 (close): 187.98
  • 成交量 (volume): 164749125.0
  • 成交量加权平均价 (vwap): 188.5845
  • 聚合窗口内交易笔数 (transactions): 2195118
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1771390800000

第 4 条数据 | UTC时间: 2026-02-19 05:00:00 | 北京时间: 2026-02-19 13:00:00

  • 开盘价 (open): 187.055
  • 最高价 (high): 188.43
  • 最低价 (low): 185.66
  • 收盘价 (close): 187.9
  • 成交量 (volume): 126554526.0
  • 成交量加权平均价 (vwap): 187.1171
  • 聚合窗口内交易笔数 (transactions): 1894648
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1771477200000

第 5 条数据 | UTC时间: 2026-02-20 05:00:00 | 北京时间: 2026-02-20 13:00:00

  • 开盘价 (open): 186.57
  • 最高价 (high): 190.33
  • 最低价 (low): 185.9378
  • 收盘价 (close): 189.82
  • 成交量 (volume): 178422337.0
  • 成交量加权平均价 (vwap): 188.9062
  • 聚合窗口内交易笔数 (transactions): 2393963
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1771563600000

第 6 条数据 | UTC时间: 2026-02-23 05:00:00 | 北京时间: 2026-02-23 13:00:00

  • 开盘价 (open): 191.4
  • 最高价 (high): 193.95
  • 最低价 (low): 189.575
  • 收盘价 (close): 191.55
  • 成交量 (volume): 171584839.114167
  • 成交量加权平均价 (vwap): 191.3441
  • 聚合窗口内交易笔数 (transactions): 2548773
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1771822800000

第 7 条数据 | UTC时间: 2026-02-24 05:00:00 | 北京时间: 2026-02-24 13:00:00

  • 开盘价 (open): 191.49
  • 最高价 (high): 193.77
  • 最低价 (low): 187.4
  • 收盘价 (close): 192.85
  • 成交量 (volume): 175123602.610203
  • 成交量加权平均价 (vwap): 192.054
  • 聚合窗口内交易笔数 (transactions): 2330529
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1771909200000

第 8 条数据 | UTC时间: 2026-02-25 05:00:00 | 北京时间: 2026-02-25 13:00:00

  • 开盘价 (open): 194.45
  • 最高价 (high): 197.6299
  • 最低价 (low): 193.79
  • 收盘价 (close): 195.56
  • 成交量 (volume): 250637102.653623
  • 成交量加权平均价 (vwap): 196.701
  • 聚合窗口内交易笔数 (transactions): 3175611
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1771995600000

第 9 条数据 | UTC时间: 2026-02-26 05:00:00 | 北京时间: 2026-02-26 13:00:00

  • 开盘价 (open): 194.27
  • 最高价 (high): 194.29
  • 最低价 (low): 184.315
  • 收盘价 (close): 184.89
  • 成交量 (volume): 360807907.423002
  • 成交量加权平均价 (vwap): 187.3002
  • 聚合窗口内交易笔数 (transactions): 4877577
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1772082000000

第 10 条数据 | UTC时间: 2026-02-27 05:00:00 | 北京时间: 2026-02-27 13:00:00

  • 开盘价 (open): 181.25
  • 最高价 (high): 182.59
  • 最低价 (low): 176.38
  • 收盘价 (close): 177.19
  • 成交量 (volume): 311636494.282879
  • 成交量加权平均价 (vwap): 179.3188
  • 聚合窗口内交易笔数 (transactions): 3823737
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1772168400000

第 11 条数据 | UTC时间: 2026-03-02 05:00:00 | 北京时间: 2026-03-02 13:00:00

  • 开盘价 (open): 175.01
  • 最高价 (high): 183.46
  • 最低价 (low): 174.64
  • 收盘价 (close): 182.48
  • 成交量 (volume): 209095331.206143
  • 成交量加权平均价 (vwap): 181.0113
  • 聚合窗口内交易笔数 (transactions): 3092782
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1772427600000

第 12 条数据 | UTC时间: 2026-03-03 05:00:00 | 北京时间: 2026-03-03 13:00:00

  • 开盘价 (open): 178.49
  • 最高价 (high): 180.9
  • 最低价 (low): 176.92
  • 收盘价 (close): 180.05
  • 成交量 (volume): 178099430.462249
  • 成交量加权平均价 (vwap): 179.3645
  • 聚合窗口内交易笔数 (transactions): 2507082
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1772514000000

第 13 条数据 | UTC时间: 2026-03-04 05:00:00 | 北京时间: 2026-03-04 13:00:00

  • 开盘价 (open): 180.44
  • 最高价 (high): 184.7
  • 最低价 (low): 180.06
  • 收盘价 (close): 183.04
  • 成交量 (volume): 177731198.894989
  • 成交量加权平均价 (vwap): 182.7363
  • 聚合窗口内交易笔数 (transactions): 2492262
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1772600400000

第 14 条数据 | UTC时间: 2026-03-05 05:00:00 | 北京时间: 2026-03-05 13:00:00

  • 开盘价 (open): 181.17
  • 最高价 (high): 184.06
  • 最低价 (low): 177.88
  • 收盘价 (close): 183.34
  • 成交量 (volume): 198779729.946372
  • 成交量加权平均价 (vwap): 181.6192
  • 聚合窗口内交易笔数 (transactions): 2736321
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1772686800000

第 15 条数据 | UTC时间: 2026-03-06 05:00:00 | 北京时间: 2026-03-06 13:00:00

  • 开盘价 (open): 179.84
  • 最高价 (high): 182.7561
  • 最低价 (low): 176.8201
  • 收盘价 (close): 177.82
  • 成交量 (volume): 189021949.003674
  • 成交量加权平均价 (vwap): 180.026
  • 聚合窗口内交易笔数 (transactions): 2564014
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1772773200000

第 16 条数据 | UTC时间: 2026-03-09 04:00:00 | 北京时间: 2026-03-09 12:00:00

  • 开盘价 (open): 176.83
  • 最高价 (high): 182.91
  • 最低价 (low): 175.56
  • 收盘价 (close): 182.65
  • 成交量 (volume): 177213588.107522
  • 成交量加权平均价 (vwap): 179.7808
  • 聚合窗口内交易笔数 (transactions): 2666893
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1773028800000

第 17 条数据 | UTC时间: 2026-03-10 04:00:00 | 北京时间: 2026-03-10 12:00:00

  • 开盘价 (open): 182.4
  • 最高价 (high): 186.44
  • 最低价 (low): 182.01
  • 收盘价 (close): 184.77
  • 成交量 (volume): 179118528.888813
  • 成交量加权平均价 (vwap): 184.6161
  • 聚合窗口内交易笔数 (transactions): 2418657
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1773115200000

第 18 条数据 | UTC时间: 2026-03-11 04:00:00 | 北京时间: 2026-03-11 12:00:00

  • 开盘价 (open): 185.91
  • 最高价 (high): 187.62
  • 最低价 (low): 184.45
  • 收盘价 (close): 186.03
  • 成交量 (volume): 145280386.177371
  • 成交量加权平均价 (vwap): 185.8987
  • 聚合窗口内交易笔数 (transactions): 1996629
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1773201600000

第 19 条数据 | UTC时间: 2026-03-12 04:00:00 | 北京时间: 2026-03-12 12:00:00

  • 开盘价 (open): 184.05
  • 最高价 (high): 184.94
  • 最低价 (low): 181.75
  • 收盘价 (close): 183.14
  • 成交量 (volume): 155762663.354942
  • 成交量加权平均价 (vwap): 183.3719
  • 聚合窗口内交易笔数 (transactions): 2142997
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1773288000000

第 20 条数据 | UTC时间: 2026-03-13 04:00:00 | 北京时间: 2026-03-13 12:00:00

  • 开盘价 (open): 184.92
  • 最高价 (high): 186.09
  • 最低价 (low): 179.94
  • 收盘价 (close): 180.25
  • 成交量 (volume): 160988424.757487
  • 成交量加权平均价 (vwap): 182.0558
  • 聚合窗口内交易笔数 (transactions): 2224692
  • 是否为场外交易 (otc): None
  • 原始时间戳 (timestamp, 毫秒): 1773374400000

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 with the RESTClient.list_aggs call shown in the report and verify how its daily interval and date range are interpreted. Compare the returned timestamps with the requested dates and determine the expected behavior for daily bars, then document a reproducible correction and regression coverage if the client is responsible.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.