diff --git a/strategy_lab.py b/strategy_lab.py index 009cbadf..dcf22a89 100644 --- a/strategy_lab.py +++ b/strategy_lab.py @@ -391,7 +391,7 @@ def prepare_sector_context(start_date, end_date): e['inflow'] = round(inflow or 0, 1) if 'change' not in e or e.get('change') is None: e['change'] = round(chg or 0, 2) - # 3. 个股→行业映射:优先 EM 体系(覆盖全,与 sector_index_daily 对齐),THS 兜底 + # 3. 个股→行业映射:优先 EM 体系(覆盖全,与 sector_index_daily 对齐),THS/港股体系兜底 try: for code, sec in conn.execute("SELECT code, sector FROM stock_sectors_em").fetchall(): _STOCK_SECTOR[code] = sec @@ -399,7 +399,7 @@ def prepare_sector_context(start_date, end_date): pass for code, sec, src in conn.execute( "SELECT code, sector_name, source FROM stock_sectors").fetchall(): - if code not in _STOCK_SECTOR and src == 'ths': + if code not in _STOCK_SECTOR and src in ('ths', 'hk_em', 'hk_manual'): _STOCK_SECTOR[code] = sec finally: conn.close()