Add Binance SIM market adapter and exchange switch in settings.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user