Add Binance SIM market adapter and exchange switch in settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-25 12:02:36 +08:00
parent 5dcec0fde0
commit 78fd046fb6
25 changed files with 879 additions and 45 deletions
+7 -2
View File
@@ -286,7 +286,10 @@ class StrategySession:
return self.ex.snapshot(self.settings.perp_inst_id)
def snapshot_dict(self) -> dict[str, Any]:
return self.ex.snapshot_dict(self.settings.perp_inst_id)
d = self.ex.snapshot_dict(self.settings.perp_inst_id)
d["exchange"] = getattr(self.ex, "name", self.settings.exchange)
d["perp_inst_id"] = self.settings.perp_inst_id
return d
async def _refresh_loop(self) -> None:
while True:
@@ -328,7 +331,9 @@ set_gateway = set_session
def bootstrap_session(settings: Settings | None = None) -> StrategySession:
"""main 启动:创建交易所 + 策略会话。"""
s = settings or get_settings()
from ..exchange.runtime import load_runtime_settings
s = settings or load_runtime_settings()
ex = build_exchange(s)
set_exchange(ex)
sess = StrategySession(s, ex)