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
+6 -4
View File
@@ -2,20 +2,22 @@
from __future__ import annotations
from ..config import Settings, get_settings
from ..config import Settings
from .protocol import ExchangeMarket
_exchange: ExchangeMarket | None = None
def build_exchange(settings: Settings | None = None) -> ExchangeMarket:
s = settings or get_settings()
name = (s.exchange or "okx").strip().lower()
from .runtime import load_runtime_settings, normalize_exchange_name
s = settings or load_runtime_settings()
name = normalize_exchange_name(s.exchange)
if name == "okx":
from .okx.adapter import OkxExchange
return OkxExchange(s)
if name in ("binance", "bn"):
if name == "binance":
from .binance.adapter import BinanceExchange
return BinanceExchange(s)