Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

部分合约历史数据有异常值 #498

Open
tosmart01 opened this issue Oct 31, 2024 · 0 comments
Open

部分合约历史数据有异常值 #498

tosmart01 opened this issue Oct 31, 2024 · 0 comments

Comments

@tosmart01
Copy link

夜盘到 23点的品种,在请求1h周期k线时,会出现 hour=23的k线, 实际k线夜盘数据应该是, 21,22, 但出现了 23

df = api.get_kline_serial("CZCE.SR809",duration_seconds=60*60, data_length=1000)
df["date"] = pd.to_datetime(df['datetime']) + timedelta(hours=8)
df.groupby(df['date'].dt.hour).date.count()

"""
date
9     126
10    126
11    126
13    126
14    127
21    123
22    123
23    123
Name: date, dtype: int64
"""
df.loc[df['date'].dt.hour==23].to_dicts("records")
"""
[{'datetime': 1.521126e+18,
  'id': 1948.0,
  'open': 5727.0,
  'high': 5728.0,
  'low': 5725.0,
  'close': 5727.0,
  'volume': 632.0,
  'open_oi': 109811.0,
  'close_oi': 109763.0,
  'symbol': 'CZCE.SR809',
  'duration': 3600,
  'date': Timestamp('2018-03-15 23:00:00')},
 {'datetime': 1.5212124e+18,
  'id': 1956.0,
  'open': 5714.0,
  'high': 5715.0,
  'low': 5708.0,
  'close': 5708.0,
  'volume': 1127.0,
  'open_oi': 112206.0,
  'close_oi': 112005.0,
  'symbol': 'CZCE.SR809',
  'duration': 3600,
  'date': Timestamp('2018-03-16 23:00:00')},
]
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant