feat(datasource): 加密货币数据支持分钟级时间精度

- flask_server.py: dataframe_to_json 增加 asset_type 参数,crypto 使用 '%Y-%m-%d %H:%M:%S' 格式
- ccxt_source.py: 移除 normalize() 调用,保留完整时间精度
- ETF/指数数据保持天级精度 '%Y-%m-%d' 不变
This commit is contained in:
2026-05-15 21:25:08 +08:00
parent a49002f622
commit 18ef2a1704
2 changed files with 21 additions and 7 deletions

View File

@@ -250,10 +250,14 @@ class CCXTSource:
return None
df = pd.DataFrame(ohlcv, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
# 转换时间戳为日期索引UTC -> 北京时间)
# 注意:保留完整时间精度(包括分钟),用于分钟级 K 线数据
df['date'] = pd.to_datetime(df['timestamp'], unit='ms', utc=True).dt.tz_convert('Asia/Shanghai')
df = df.set_index('date')
df = df[['open', 'high', 'low', 'close', 'volume']]
df.index = df.index.normalize()
# 注意:不再使用 normalize(),保留完整时间精度
return df