Audit fixes: LIVE symbols/fills/expiry/pending, security harden, add 更新说明.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-26 22:28:03 +08:00
parent bc8d1fb127
commit f48ea5bbcc
18 changed files with 1389 additions and 1069 deletions
+33
View File
@@ -0,0 +1,33 @@
"""LIVE 合约解析。"""
from app.live.symbols import resolve_perp_inst_id
class _FakeDb:
def __init__(self, row=None):
self._row = row
def fetchone(self, sql, args=()):
return self._row
def test_resolve_perp_prefers_group(monkeypatch) -> None:
import app.live.symbols as sym
class S:
perp_inst_id = "ETH-USDT-SWAP"
monkeypatch.setattr(sym, "live_settings", lambda: S())
db = _FakeDb({"perp_inst_id": "ETHUSDT"})
assert resolve_perp_inst_id(db, group_id="g1") == "ETHUSDT"
def test_resolve_perp_fallback_runtime(monkeypatch) -> None:
import app.live.symbols as sym
class S:
perp_inst_id = "ETHUSDT"
monkeypatch.setattr(sym, "live_settings", lambda: S())
db = _FakeDb(None)
assert resolve_perp_inst_id(db) == "ETHUSDT"