## 核心功能 - FlaskAPIFetcher: 继承 DataFetcher 抽象基类 - fetch_indices(): 获取指数 OHLCV 数据 - fetch_etf(): 获取 ETF 数据(自动附加净值+溢价率) - get_trading_calendar(): 获取交易日历 - get_benchmark(): 获取基准数据 ## 技术实现 - 委托调用 FlaskAPIDataSource(HTTP API) - 自动重试 3 次,超时 120 秒 - Pydantic Schema 验证响应 - 进度显示(批量获取) - 无需本地 SSH 隧道配置 ## 测试验证 - 5/5 测试通过(健康检查、指数、ETF、日历、基准) - 成功获取线上数据(000300.SH, 510300.SH) - ETF 自动附加净值(3695 条)和溢价率 ## 架构设计 - shared/data/flask_api_fetcher.py - 实现(262 行) - tests/test_flask_api_fetcher.py - 测试(199 行) - 依赖倒置原则(策略依赖抽象接口)
22 lines
494 B
Python
22 lines
494 B
Python
"""
|
|
通用数据处理
|
|
"""
|
|
|
|
from framework_v2.shared.data.alignment import CrossMarketAligner
|
|
from framework_v2.shared.data.schemas import (
|
|
OHLCVInputSchema,
|
|
AlignedFactorSchema,
|
|
AlignedReturnsSchema,
|
|
AlignmentValidationResult,
|
|
)
|
|
from framework_v2.shared.data.flask_api_fetcher import FlaskAPIFetcher
|
|
|
|
__all__ = [
|
|
'CrossMarketAligner',
|
|
'OHLCVInputSchema',
|
|
'AlignedFactorSchema',
|
|
'AlignedReturnsSchema',
|
|
'AlignmentValidationResult',
|
|
'FlaskAPIFetcher',
|
|
]
|