Open tosmart01 opened 1 month ago
夜盘到 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')}, ] """
夜盘到 23点的品种,在请求1h周期k线时,会出现 hour=23的k线, 实际k线夜盘数据应该是, 21,22, 但出现了 23