fix(hub): archive chart perpetual label and trade row highlight

Label archive K-lines as USDT swap in title and API; highlight the full trade row when opening its chart.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-11 19:56:55 +08:00
parent a9637fafb2
commit a87234f627
5 changed files with 52 additions and 6 deletions
+14
View File
@@ -67,6 +67,20 @@ def normalize_chart_timeframe(raw: str | None, default: str = "5m") -> str:
return tf if tf in CHART_TIMEFRAMES else default
def normalize_perpetual_symbol(symbol: str) -> str:
"""BTC/USDT → BTC/USDT:USDT(与四所 ccxt swap 行情一致)。"""
sym = (symbol or "").strip().upper()
if not sym:
return ""
if ":" in sym:
return sym
if "/" in sym:
base, quote = sym.split("/", 1)
quote_clean = quote.split(":")[0]
return f"{base}/{quote_clean}:{quote_clean}"
return sym
def sync_timeframe_for_display(timeframe: str) -> str:
"""展示周期对应的入库 / 同步周期。"""
tf = normalize_chart_timeframe(timeframe)