fix(HEL-356): restore intraday turnover context
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -368,6 +368,11 @@ class DashboardMixin:
|
||||
basic = basics[0] if basics else {}
|
||||
capital = self._latest_capital(ts_code, reference_date)
|
||||
float_share = _number(capital.get("float_share"))
|
||||
if not float_share and previous_close:
|
||||
# The hub's canonical valuation table stores market values but not
|
||||
# share counts. circ_mv (10k CNY) / price (CNY) is float shares in
|
||||
# 10k shares, the same unit used by the turnover formula below.
|
||||
float_share = _number(capital.get("circ_mv")) / previous_close
|
||||
# rt_k volume is shares; daily_basic float_share is reported in 10k shares.
|
||||
turnover_rate = _number(row.get("vol")) / float_share / 100 if float_share else 0
|
||||
market_date = reference_date or datetime.now().astimezone().strftime("%Y%m%d")
|
||||
@@ -389,6 +394,13 @@ class DashboardMixin:
|
||||
for item in market_rows:
|
||||
item_capital = capital_map.get(str(item.get("ts_code") or ""), {})
|
||||
item_float_share = _number(item_capital.get("float_share"))
|
||||
item_previous = _number(
|
||||
item.get("pre_close")
|
||||
if item.get("pre_close") not in (None, "")
|
||||
else item.get("previous_close")
|
||||
)
|
||||
if not item_float_share and item_previous:
|
||||
item_float_share = _number(item_capital.get("circ_mv")) / item_previous
|
||||
if item_float_share:
|
||||
market_turnovers.append(_number(item.get("vol")) / item_float_share / 100)
|
||||
market_turnover = (
|
||||
|
||||
Reference in New Issue
Block a user