fix(HEL-356): complete Shenwan industry signal

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总管
2026-09-09 17:59:58 +08:00
co-authored by multica-agent
parent c3881af708
commit 88411efa1c
7 changed files with 151 additions and 18 deletions
@@ -169,6 +169,16 @@ class ShenwanIndustryMixin:
)
else:
outer_error = rt_error or outer_error
if not outer_precise:
# The exact SW L2 member set and every member's final daily bar
# are already available. Use their equal-weight move as an
# explicitly labelled provisional outer value until Tushare's
# official sw_daily row is published.
daily = {"change": equal_change}
actual_trade_date = trade_date
outer_precise = True
outer_source = "sw_member_equal_daily"
outer_error = ""
else:
try:
snapshot = self._sw_realtime_sector_snapshot(
@@ -520,6 +530,12 @@ class ShenwanIndustryMixin:
for item in members
}
equal_change = sum(item["change"] for item in valid) / len(valid) if valid else 0
if not outer_precise and inner_precise:
official_change = equal_change
outer_precise = True
outer_source = "sw_member_equal_realtime"
outer_error = ""
quote_date = trade_date
amount_billion = sum(_number(item.get("amount")) for item in valid) / 100000000
market_rows: list[dict[str, Any]] = []
try:
@@ -642,6 +658,11 @@ class ShenwanIndustryMixin:
return {}, "", f"申万行业 {sector_code} 盘后正式数据待入库"
return {}, "", f"数据中枢申万实时暂不可用:{message[:180]}"
if row:
actual_name = str(row.get("name") or "").strip()
if sector_name and actual_name != str(sector_name).strip():
return {}, "", (
f"数据中枢返回的行业名称不匹配:期望 {sector_name},实际 {actual_name or '--'}"
)
return dict(row), str(row.get("source") or "datahub"), ""
if finalized:
return {}, "", f"申万行业 {sector_code} 当日盘后正式数据尚未入库"