feat(web): 增量自动刷新、结构区修复与默认指标/周期
自动刷新常态只拉 recent 尾部 K,每 1 分钟全量重算缠论;修复结构区缓存导入;默认指标/4h·1h·15m/近30天;同步 ECR-009 screener 相关改动。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
"""Crypto symbol → Chinese display name for screener UI."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
# Base asset → 中文名(覆盖 provider 当前币对;未知则回退 base)
|
||||
_BASE_CN: dict[str, str] = {
|
||||
"BTC": "比特币",
|
||||
"ETH": "以太坊",
|
||||
"SOL": "索拉纳",
|
||||
"XAU": "黄金",
|
||||
"XAG": "白银",
|
||||
"SAGA": "Saga",
|
||||
"CL": "原油",
|
||||
"ZEC": "大零币",
|
||||
"XRP": "瑞波币",
|
||||
"DOGE": "狗狗币",
|
||||
"BNB": "币安币",
|
||||
"SUI": "Sui",
|
||||
"BILL": "Bill",
|
||||
"BZ": "BZ",
|
||||
"LAB": "Lab",
|
||||
"TON": "通联币",
|
||||
"CRCL": "Circle",
|
||||
"SNDK": "SNDK",
|
||||
"1000PEPE": "千倍佩佩",
|
||||
"PEPE": "佩佩",
|
||||
"CHIP": "CHIP",
|
||||
"WIF": "狗帽子",
|
||||
}
|
||||
|
||||
|
||||
def base_asset(symbol: str) -> str:
|
||||
"""BTC/USDT:USDT → BTC;1000PEPE/USDT:USDT → 1000PEPE."""
|
||||
s = (symbol or "").strip()
|
||||
if not s:
|
||||
return ""
|
||||
head = s.split(":")[0]
|
||||
return head.split("/")[0].upper() if "/" in head else head.upper()
|
||||
|
||||
|
||||
def display_name_cn(symbol: str) -> str:
|
||||
base = base_asset(symbol)
|
||||
if not base:
|
||||
return symbol or ""
|
||||
return _BASE_CN.get(base, base)
|
||||
|
||||
|
||||
def symbol_name_map(symbols: list[str] | None = None) -> dict[str, str]:
|
||||
if not symbols:
|
||||
return {f"{k}/USDT:USDT": v for k, v in _BASE_CN.items()}
|
||||
return {s: display_name_cn(s) for s in symbols}
|
||||
Reference in New Issue
Block a user