Files
tick-stock-panel/backend/tests/test_resolve_universe_index.py
T
intfoo ed4355e0ea feat: 指数(asset_type=index)后端接入 — 数据路由/自选enriched/监控指数轮/隔离防污染
- 数据路由: get_name_map 合并指数维表; get_enriched_latest_asset("index") 缓存+flush/merge 分支; daily-batch 按资产分组
- 自选: watchlist_enriched 指数分支 + 行级 asset_type 标注
- 监控: MonitorRuleEngine 第三轮指数评估 (signal/price); 指数实时焐热复刻 ETF flush; Free档自选实时资产分流; 规则校验 (禁 strategy/market/ladder/分时信号)
- 隔离: _resolve_universe 过滤指数防污染股票日K/分钟K; 指数轮 reset_strategy_results=False; 策略/回测/screener 零改动
- AI 分析: prompt 指数无财务文案
2026-07-26 18:35:31 +08:00

30 lines
980 B
Python

"""_resolve_universe 指数过滤测试。"""
import pytest
from app.jobs import daily_pipeline
from app.tickflow.repository import DataStore, KlineRepository
@pytest.fixture()
def repo(tmp_path):
return KlineRepository(DataStore(tmp_path))
def test_resolve_universe_excludes_index_symbols(repo, monkeypatch, tmp_path):
"""自选里的指数不进入股票日K/分钟K同步池。"""
class _Capset:
def has(self, cap):
return False
monkeypatch.setattr(
daily_pipeline, "get_pool",
lambda name, refresh=False: ["600000.SH", "000001.SH"] if name == "watchlist" else [],
)
monkeypatch.setattr(daily_pipeline, "DEMO_SYMBOLS", [])
monkeypatch.setattr(daily_pipeline.settings, "data_dir", tmp_path)
monkeypatch.setattr(repo, "get_index_symbol_set", lambda: {"000001.SH"})
universe = daily_pipeline._resolve_universe(_Capset(), repo)
assert "600000.SH" in universe
assert "000001.SH" not in universe