feat: 港股板块指数全量拓展——EM所属行业覆盖253只(50个行业)+自建板块指数137个,sector_slope因子对港股全量生效
This commit is contained in:
+2
-2
@@ -391,7 +391,7 @@ def prepare_sector_context(start_date, end_date):
|
|||||||
e['inflow'] = round(inflow or 0, 1)
|
e['inflow'] = round(inflow or 0, 1)
|
||||||
if 'change' not in e or e.get('change') is None:
|
if 'change' not in e or e.get('change') is None:
|
||||||
e['change'] = round(chg or 0, 2)
|
e['change'] = round(chg or 0, 2)
|
||||||
# 3. 个股→行业映射:优先 EM 体系(覆盖全,与 sector_index_daily 对齐),THS 兜底
|
# 3. 个股→行业映射:优先 EM 体系(覆盖全,与 sector_index_daily 对齐),THS/港股体系兜底
|
||||||
try:
|
try:
|
||||||
for code, sec in conn.execute("SELECT code, sector FROM stock_sectors_em").fetchall():
|
for code, sec in conn.execute("SELECT code, sector FROM stock_sectors_em").fetchall():
|
||||||
_STOCK_SECTOR[code] = sec
|
_STOCK_SECTOR[code] = sec
|
||||||
@@ -399,7 +399,7 @@ def prepare_sector_context(start_date, end_date):
|
|||||||
pass
|
pass
|
||||||
for code, sec, src in conn.execute(
|
for code, sec, src in conn.execute(
|
||||||
"SELECT code, sector_name, source FROM stock_sectors").fetchall():
|
"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
|
_STOCK_SECTOR[code] = sec
|
||||||
finally:
|
finally:
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user