mirror of
https://ghfast.top/https://github.com/aeroxw/tick-stock-panel.git
synced 2026-09-12 17:54:15 +08:00
fix(stocksdk): normalize realtime change percentage
This commit is contained in:
@@ -203,7 +203,16 @@ class StockSDKProvider:
|
||||
except bridge.StockSDKBridgeError as e:
|
||||
logger.warning("stock-sdk realtime 拉取失败: %s", e)
|
||||
return []
|
||||
return result.get("rows") or []
|
||||
rows = result.get("rows") or []
|
||||
normalized: list[dict] = []
|
||||
for row in rows:
|
||||
item = dict(row)
|
||||
# stock-sdk 的 changePercent 是百分数值(-1.15 = -1.15%);
|
||||
# provider 入口契约统一使用小数制(-0.0115 = -1.15%)。
|
||||
if item.get("change_pct") is not None:
|
||||
item["change_pct"] = float(item["change_pct"]) / 100
|
||||
normalized.append(item)
|
||||
return normalized
|
||||
|
||||
# ---- instruments (标的维表) ----
|
||||
def get_instruments(self, asset_type: str = "stock") -> list[dict]:
|
||||
|
||||
Reference in New Issue
Block a user