移除自选和回测功能

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-04 17:41:08 +08:00
parent ab6282b94c
commit a45aa5b033
49 changed files with 43 additions and 10091 deletions
+1 -16
View File
@@ -3,7 +3,6 @@
Phase 1 实现:
- 常用指数成份(沪深 300 / 中证 500 / 上证 50)用 TickFlow `quote.pool` 端点拉取并缓存
- 全 A 通过 instruments.batch 获取
- 自选池 = 用户的 watchlist
"""
from __future__ import annotations
@@ -19,7 +18,7 @@ from app.tickflow.client import get_client
logger = logging.getLogger(__name__)
PoolId = Literal["CSI300", "CSI500", "SSE50", "CN_Equity_A", "CN_Index", "watchlist"]
PoolId = Literal["CSI300", "CSI500", "SSE50", "CN_Equity_A", "CN_Index"]
# TickFlow universe id 是它内部命名(见 tf.universes.list())。
# 没有官方对照表,启动时按名称模糊匹配从 universes.list() 里找。
@@ -54,9 +53,6 @@ def _pool_cache_path(pool_id: str) -> Path:
def get_pool(pool_id: PoolId, refresh: bool = False) -> list[str]:
"""返回标的池里的 symbol 列表。"""
if pool_id == "watchlist":
return _load_watchlist()
cache = _pool_cache_path(pool_id)
if cache.exists() and not refresh:
df = pl.read_parquet(cache)
@@ -132,17 +128,6 @@ def _fetch_pool(pool_id: PoolId) -> list[str]:
return []
def _load_watchlist() -> list[str]:
"""读取用户自选(由 watchlist service 维护)。"""
path = settings.data_dir / "user_data" / "watchlist.parquet"
if not path.exists():
return []
df = pl.read_parquet(path)
if df.is_empty() or "symbol" not in df.columns:
return []
return df["symbol"].to_list()
# 兜底:Free 用户/无 API 时给一个小型可用集合,让 UI 不至于空白
DEMO_SYMBOLS = [
"600000.SH", # 浦发银行
+2 -3
View File
@@ -56,7 +56,6 @@ class DataStore:
"instruments_ext",
"kline_ext",
"pools",
"backtest_results",
"screener_results",
"ai_cache",
"user_data",
@@ -77,7 +76,7 @@ class DataStore:
背景: 旧版 data_dir = exe_dir.parent / "TickFlowStockPanel_Data" (兄弟目录),
新版改为 exe_dir / "data" (子目录)。老用户首次升级时旧数据在兄弟目录,
若不迁移会导致历史行情/策略/回测/监控全部"丢失"(实际还在旧位置)。
若不迁移会导致历史行情/策略/监控全部"丢失"(实际还在旧位置)。
策略 (仅打包桌面版触发, 开发/Docker 不受影响):
1. 旧目录存在且新 data/ 还基本为空 → 整目录搬迁 (shutil.move, 跨盘符安全)。
@@ -408,7 +407,7 @@ class KlineRepository:
how="left",
)
# 缓存完整历史 (含指标+必要基础信息) 供 filter_history/backtest 直接复用
# 缓存完整历史 (含指标+必要基础信息)
self._enriched_history_cache = df_full
self._enriched_history_start = df_full["date"].min()
logger.info("enriched 历史缓存: %d rows, %s ~ %s",