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:
dekun
2026-07-08 23:42:26 +08:00
parent aaa72c7961
commit b733e551a0
392 changed files with 71522 additions and 71369 deletions
@@ -1,18 +1,18 @@
#!/usr/bin/env python3
"""
一次性修复历史交易记录标签
将 trade_records 里“止损但实际盈利”的记录改为“保本止盈”
一次性修复历史交易记录标签:
将 trade_records 里“止损但实际盈利”的记录改为“保本止盈”.
默认条件可通过参数修改):
默认条件(可通过参数修改):
- monitor_type = 下单监控
- result = 止损
- pnl_amount > 0
用法示例
1) 仅预览不落库):
用法示例:
1) 仅预览(不落库):
python scripts/fix_breakeven_labels.py --db ./crypto.db --dry-run
2) 执行修复
2) 执行修复:
python scripts/fix_breakeven_labels.py --db ./crypto.db --apply
"""
@@ -1,52 +1,52 @@
#!/usr/bin/env python3
"""
python scripts/verify_okx_funding.py
打印 OKX_API_KEY 前 8 位便于与 Binance 控制台核对不含 Secret)。用于服务器自检
"""
import os
import sys
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, BASE)
def load_env(path):
if not os.path.exists(path):
return
for line in open(path, "r", encoding="utf-8", errors="ignore"):
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
k, v = line.split("=", 1)
k = k.strip().lstrip("\ufeff")
if k.replace("_", "").isalnum():
os.environ[k] = v.strip().strip('"').strip("'")
def main():
load_env(os.path.join(BASE, ".env"))
k = (os.getenv("OKX_API_KEY") or "").strip()
s = (os.getenv("OKX_API_SECRET") or "").strip()
if not k or "REPLACE" in k.upper():
print("WARN: OKX_API_KEY 为空或仍像占位符请核对 .env")
if not s or "REPLACE" in s.upper():
print("WARN: OKX_API_SECRET 为空或仍像占位符请核对 .env")
print("OKX_API_KEY prefix (8 chars):", (k[:8] + "") if len(k) > 8 else "(short)")
import app as mod # noqa: E402
mod.ensure_markets_loaded()
fu = mod._fetch_okx_funding_usdt()
print(">>> _fetch_okx_funding_usdt() =", fu)
try:
sw = mod._fetch_okx_swap_usdt_total()
print(">>> _fetch_okx_swap_usdt_total() (合约账户) =", sw)
sf = mod._fetch_okx_swap_usdt_free()
print(">>> _fetch_okx_swap_usdt_free() (合约可用) =", sf)
except Exception as e:
print(">>> swap balance fetch error:", e)
if __name__ == "__main__":
main()
#!/usr/bin/env python3
"""
python scripts/verify_okx_funding.py
打印 OKX_API_KEY 前 8 位便于与 Binance 控制台核对(不含 Secret).用于服务器自检.
"""
import os
import sys
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, BASE)
def load_env(path):
if not os.path.exists(path):
return
for line in open(path, "r", encoding="utf-8", errors="ignore"):
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
k, v = line.split("=", 1)
k = k.strip().lstrip("\ufeff")
if k.replace("_", "").isalnum():
os.environ[k] = v.strip().strip('"').strip("'")
def main():
load_env(os.path.join(BASE, ".env"))
k = (os.getenv("OKX_API_KEY") or "").strip()
s = (os.getenv("OKX_API_SECRET") or "").strip()
if not k or "REPLACE" in k.upper():
print("WARN: OKX_API_KEY 为空或仍像占位符,请核对 .env")
if not s or "REPLACE" in s.upper():
print("WARN: OKX_API_SECRET 为空或仍像占位符,请核对 .env")
print("OKX_API_KEY prefix (8 chars):", (k[:8] + "") if len(k) > 8 else "(short)")
import app as mod # noqa: E402
mod.ensure_markets_loaded()
fu = mod._fetch_okx_funding_usdt()
print(">>> _fetch_okx_funding_usdt() =", fu)
try:
sw = mod._fetch_okx_swap_usdt_total()
print(">>> _fetch_okx_swap_usdt_total() (合约账户) =", sw)
sf = mod._fetch_okx_swap_usdt_free()
print(">>> _fetch_okx_swap_usdt_free() (合约可用) =", sf)
except Exception as e:
print(">>> swap balance fetch error:", e)
if __name__ == "__main__":
main()