Realign ATM to current mark before open; skip while in position.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-25 07:52:37 +08:00
parent 1155cf082d
commit 7db4c9c8a3
4 changed files with 70 additions and 6 deletions
+5
View File
@@ -135,6 +135,11 @@ class StrategyEngine:
await asyncio.sleep(1)
continue
async with self._lock:
# 空仓且 ATM 偏离现价时先重选,再跑开仓逻辑
try:
await get_gateway().ensure_atm_async(force=False)
except Exception as e:
logger.warning("ATM ensure before tick failed: %s", e)
await asyncio.to_thread(self._tick)
except asyncio.CancelledError:
raise