Split exchange and strategy modules for future Binance support.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-25 08:43:09 +08:00
parent 3957a83761
commit e19bb452f9
27 changed files with 1504 additions and 1048 deletions
+3 -4
View File
@@ -8,7 +8,7 @@ import time
from typing import Any
from ..config import get_settings
from ..market import get_gateway
from .session import get_session
from ..models.db import get_db
from ..sim.ledger import Ledger
from ..sim.matcher import Matcher
@@ -131,7 +131,7 @@ class StrategyEngine:
continue
async with self._lock:
try:
await get_gateway().ensure_atm_async(force=False)
await get_session().ensure_atm_async(force=False)
except Exception as e:
logger.warning("ATM ensure before tick failed: %s", e)
await self._tick_async()
@@ -191,8 +191,7 @@ class StrategyEngine:
self._set_state(phase="idle")
self._set_state(phase="wait_signal")
gw = get_gateway()
pick = await gw.pick_for_open_async()
pick = await get_session().pick_for_open_async()
if pick is None:
self._set_state(
last_error="无合格期权:需剩余时长与杠杆倍数同时满足"