Split exchange and strategy modules for future Binance support.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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="无合格期权:需剩余时长与杠杆倍数同时满足"
|
||||
|
||||
Reference in New Issue
Block a user