refactor: 重构 API 接口模块,整合为 api_wrappers 目录结构

- 将独立 API 模块 (daily, stock_basic, trade_cal) 整合至 api_wrappers/
- 重写 sync.py 使用新的 wrapper 结构,支持更多同步功能
- 更新测试文件适配新的模块结构
- 添加 pytest.ini 配置文件
This commit is contained in:
2026-02-21 03:43:30 +08:00
parent e81d39ae0d
commit 9965ce5706
15 changed files with 1042 additions and 952 deletions

View File

@@ -0,0 +1,40 @@
"""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_stock_basic: Stock basic information (股票基本信息)
- api_trade_cal: Trading calendar (交易日历)
Example:
>>> from src.data.api_wrappers import get_daily, get_stock_basic, get_trade_cal
>>> data = get_daily('000001.SZ', start_date='20240101', end_date='20240131')
>>> stocks = get_stock_basic()
>>> calendar = get_trade_cal('20240101', '20240131')
"""
from src.data.api_wrappers.api_daily import get_daily
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",
# 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",
]