Normalize fullwidth punctuation to ASCII across codebase.
Add scripts/normalize_ambiguous_unicode.py; fix corrupted patch_instance_theme_templates.py. Preserves curly quotes in string literals; removes Git homoglyph warnings on .env.example. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""实例页:持仓未实现盈亏(实时盈亏)汇总。"""
|
||||
"""实例页:持仓未实现盈亏(实时盈亏)汇总."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
@@ -8,7 +8,7 @@ from lib.hub.hub_position_metrics import parse_position_unrealized_pnl
|
||||
|
||||
|
||||
def position_row_contracts(pos: dict[str, Any]) -> float:
|
||||
"""持仓张数:与三所 app 内 _position_row_effective_contracts 规则一致。"""
|
||||
"""持仓张数:与三所 app 内 _position_row_effective_contracts 规则一致."""
|
||||
if not isinstance(pos, dict):
|
||||
return 0.0
|
||||
info = pos.get("info") or {}
|
||||
@@ -67,7 +67,7 @@ def sum_unrealized_pnl_from_metrics(
|
||||
rows: list[dict[str, Any]] | list[Any],
|
||||
get_metrics_fn: Callable[[str, str], dict[str, Any] | None],
|
||||
) -> float | None:
|
||||
"""按活跃监控单逐笔拉交易所 metrics 汇总(与持仓卡浮盈亏一致)。"""
|
||||
"""按活跃监控单逐笔拉交易所 metrics 汇总(与持仓卡浮盈亏一致)."""
|
||||
total = 0.0
|
||||
found = False
|
||||
for row in rows or []:
|
||||
@@ -103,7 +103,7 @@ def resolve_instance_unrealized_pnl(
|
||||
active_rows: list[Any] | None,
|
||||
get_metrics_fn: Callable[[str, str], dict[str, Any] | None] | None,
|
||||
) -> float | None:
|
||||
"""先全量持仓汇总,失败或无数据时回退到活跃监控单 metrics。"""
|
||||
"""先全量持仓汇总,失败或无数据时回退到活跃监控单 metrics."""
|
||||
total = fetch_unrealized_pnl(fetch_positions_fn)
|
||||
if total is not None:
|
||||
return total
|
||||
@@ -113,7 +113,7 @@ def resolve_instance_unrealized_pnl(
|
||||
|
||||
|
||||
def merge_unrealized_pnl_components(*parts: float | None) -> float | None:
|
||||
"""合并永续与期权等多路未实现盈亏(任一路有值即参与合计)。"""
|
||||
"""合并永续与期权等多路未实现盈亏(任一路有值即参与合计)."""
|
||||
total = 0.0
|
||||
found = False
|
||||
for part in parts:
|
||||
|
||||
Reference in New Issue
Block a user