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 @@
|
||||
"""顺势加仓 UI:滚仓腿合并均价与止盈盈利展示(实例页 + 中控)。"""
|
||||
"""顺势加仓 UI:滚仓腿合并均价与止盈盈利展示(实例页 + 中控)."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Optional
|
||||
@@ -16,7 +16,7 @@ def reward_at_tp_usdt(
|
||||
*,
|
||||
contract_size: float = 1.0,
|
||||
) -> Optional[float]:
|
||||
"""与 strategy_roll_lib.preview_roll 一致:线性合约 U 本位盈利。"""
|
||||
"""与 strategy_roll_lib.preview_roll 一致:线性合约 U 本位盈利."""
|
||||
try:
|
||||
avg = float(avg_entry)
|
||||
tp = float(take_profit)
|
||||
@@ -57,7 +57,7 @@ def infer_initial_position(
|
||||
*,
|
||||
monitor: dict | None = None,
|
||||
) -> tuple[Optional[float], Optional[float]]:
|
||||
"""由当前持仓与各腿成交价反推首仓张数/均价。"""
|
||||
"""由当前持仓与各腿成交价反推首仓张数/均价."""
|
||||
try:
|
||||
qty_live = float(qty_live)
|
||||
entry_live = float(entry_live)
|
||||
@@ -106,7 +106,7 @@ def compute_roll_chain_metrics(
|
||||
contract_size: float = 1.0,
|
||||
) -> tuple[dict[Any, dict], dict]:
|
||||
"""
|
||||
返回 (leg_metrics_by_id, group_metrics)。
|
||||
返回 (leg_metrics_by_id, group_metrics).
|
||||
leg_metrics: leg id -> {avg_entry_after, reward_at_tp_usdt}
|
||||
group_metrics: 最后一腿后的 {avg_entry, reward_at_tp_usdt}
|
||||
"""
|
||||
@@ -187,7 +187,7 @@ def _row_to_dict(row) -> dict:
|
||||
|
||||
|
||||
def _resolve_roll_live(cfg: dict, group: dict, monitor: dict | None) -> tuple[Optional[float], Optional[float], float]:
|
||||
"""读取交易所持仓张数、均价、contract_size。"""
|
||||
"""读取交易所持仓张数,均价,contract_size."""
|
||||
m = cfg.get("app_module")
|
||||
ex_sym = group.get("exchange_symbol")
|
||||
sym = group.get("symbol") or ""
|
||||
@@ -244,7 +244,7 @@ def _resolve_roll_live(cfg: dict, group: dict, monitor: dict | None) -> tuple[Op
|
||||
|
||||
|
||||
def enrich_roll_page_data(conn, page_data: dict, cfg: dict | None) -> dict:
|
||||
"""为 roll_groups / roll_legs 附加 avg_entry、reward_at_tp 展示字段。"""
|
||||
"""为 roll_groups / roll_legs 附加 avg_entry,reward_at_tp 展示字段."""
|
||||
if not isinstance(page_data, dict) or not cfg:
|
||||
return page_data
|
||||
groups = list(page_data.get("roll_groups") or [])
|
||||
@@ -313,7 +313,7 @@ def enrich_roll_page_data(conn, page_data: dict, cfg: dict | None) -> dict:
|
||||
|
||||
|
||||
def enrich_roll_groups_for_hub(rolls: list[dict], conn, cfg: dict | None) -> list[dict]:
|
||||
"""中控 monitor API:每组附带当前均价、止盈盈利与最近滚仓腿。"""
|
||||
"""中控 monitor API:每组附带当前均价,止盈盈利与最近滚仓腿."""
|
||||
if not rolls or not cfg:
|
||||
return rolls
|
||||
out = []
|
||||
@@ -396,7 +396,7 @@ def enrich_roll_groups_for_hub(rolls: list[dict], conn, cfg: dict | None) -> lis
|
||||
|
||||
|
||||
def patch_roll_hub_enrich(app: Flask, cfg: dict) -> None:
|
||||
"""hub_bridge install 后:/api/hub/monitor 的 rolls 附带均价/止盈盈利。"""
|
||||
"""hub_bridge install 后:/api/hub/monitor 的 rolls 附带均价/止盈盈利."""
|
||||
ctx = dict(app.config.get("HUB_CTX") or {})
|
||||
prev: Callable | None = ctx.get("enrich_monitor")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user