行情K线:分类主力选择、图表指标与布局稳定

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-15 18:23:39 +08:00
parent 65992eb35e
commit 404872007f
8 changed files with 644 additions and 114 deletions
+17 -1
View File
@@ -66,7 +66,23 @@ def _fetch_sina_raw(sina_code: str) -> Optional[dict]:
return None
price = float(parts[8])
volume = float(parts[14]) if len(parts) > 14 and parts[14] else 0
return {"name": parts[0], "price": price, "volume": volume}
prev_close = None
if len(parts) > 9 and parts[9]:
try:
prev_close = float(parts[9])
except ValueError:
pass
if prev_close is None and len(parts) > 2 and parts[2]:
try:
prev_close = float(parts[2])
except ValueError:
pass
return {
"name": parts[0],
"price": price,
"volume": volume,
"prev_close": prev_close,
}
except Exception as exc:
logger.debug("sina fetch failed %s: %s", sina_code, exc)
return None