- 删除旧因子框架:移除 base.py、composite.py、data_loader.py、data_spec.py 及所有子模块(momentum、financial、quality、sentiment等) - 新增DSL表达式系统:实现 factor DSL 编译器和翻译器 - dsl.py: 领域特定语言定义 - compiler.py: AST编译与优化 - translator.py: Polars表达式翻译 - api.py: 统一API接口 - 新增数据路由层:data_router.py 实现字段到表的动态路由 - 新增API封装:api_pro_bar.py 提供pro_bar数据接口 - 更新执行引擎:engine.py 适配新的DSL架构 - 重构测试体系:删除旧测试,新增 test_dsl_promotion.py、 test_factor_integration.py、test_pro_bar.py - 清理文档:删除8个过时文档(factor_design、db_sync_guide等)
83 lines
2.5 KiB
Python
83 lines
2.5 KiB
Python
"""Tushare API wrapper modules.
|
|
|
|
This package contains simplified interfaces for fetching data from Tushare API.
|
|
All wrapper files follow the naming convention: api_{data_type}.py
|
|
|
|
Available APIs:
|
|
- api_daily: Daily market data (日线行情)
|
|
- api_pro_bar: Pro Bar universal market data (通用行情,后复权)
|
|
- api_stock_basic: Stock basic information (股票基本信息)
|
|
- api_trade_cal: Trading calendar (交易日历)
|
|
- api_namechange: Stock name change history (股票曾用名)
|
|
- api_bak_basic: Stock historical list (股票历史列表)
|
|
|
|
Example:
|
|
>>> from src.data.api_wrappers import get_daily, get_stock_basic, get_trade_cal, get_bak_basic
|
|
>>> from src.data.api_wrappers import get_pro_bar, sync_pro_bar
|
|
>>> data = get_daily('000001.SZ', start_date='20240101', end_date='20240131')
|
|
>>> pro_data = get_pro_bar('000001.SZ', start_date='20240101', end_date='20240131')
|
|
>>> stocks = get_stock_basic()
|
|
>>> calendar = get_trade_cal('20240101', '20240131')
|
|
>>> bak_basic = get_bak_basic(trade_date='20240101')
|
|
"""
|
|
|
|
from src.data.api_wrappers.api_daily import (
|
|
get_daily,
|
|
sync_daily,
|
|
preview_daily_sync,
|
|
DailySync,
|
|
)
|
|
from src.data.api_wrappers.api_pro_bar import (
|
|
get_pro_bar,
|
|
sync_pro_bar,
|
|
preview_pro_bar_sync,
|
|
ProBarSync,
|
|
)
|
|
from src.data.api_wrappers.financial_data.api_income import (
|
|
get_income,
|
|
sync_income,
|
|
IncomeSync,
|
|
)
|
|
from src.data.api_wrappers.api_bak_basic import get_bak_basic, sync_bak_basic
|
|
from src.data.api_wrappers.api_namechange import get_namechange, sync_namechange
|
|
from src.data.api_wrappers.api_stock_basic import get_stock_basic, sync_all_stocks
|
|
from src.data.api_wrappers.api_trade_cal import (
|
|
get_trade_cal,
|
|
get_trading_days,
|
|
get_first_trading_day,
|
|
get_last_trading_day,
|
|
sync_trade_cal_cache,
|
|
)
|
|
|
|
__all__ = [
|
|
# Daily market data
|
|
"get_daily",
|
|
"sync_daily",
|
|
"preview_daily_sync",
|
|
"DailySync",
|
|
# Pro Bar (universal market data)
|
|
"get_pro_bar",
|
|
"sync_pro_bar",
|
|
"preview_pro_bar_sync",
|
|
"ProBarSync",
|
|
# Income statement
|
|
"get_income",
|
|
"sync_income",
|
|
"IncomeSync",
|
|
# Historical stock list
|
|
"get_bak_basic",
|
|
"sync_bak_basic",
|
|
# Namechange
|
|
"get_namechange",
|
|
"sync_namechange",
|
|
# Stock basic information
|
|
"get_stock_basic",
|
|
"sync_all_stocks",
|
|
# Trade calendar
|
|
"get_trade_cal",
|
|
"get_trading_days",
|
|
"get_first_trading_day",
|
|
"get_last_trading_day",
|
|
"sync_trade_cal_cache",
|
|
]
|