fix(trend): use mark price for DCA trigger on gate_bot

Poll trend plans with mark price (same as UI) instead of ticker last, add get_symbol_mark_price to gate_bot, tolerate position API blips, and log DCA order failures.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-07 17:38:26 +08:00
parent d56d9050aa
commit 0760873d9d
3 changed files with 82 additions and 11 deletions
+18
View File
@@ -4370,6 +4370,24 @@ def get_price(symbol):
except:
return None
def get_symbol_mark_price(symbol):
"""趋势补仓/标记价展示:优先 ticker.mark,与页面浮盈亏口径一致。"""
ex_sym = normalize_exchange_symbol(symbol)
try:
ensure_markets_loaded()
ticker = exchange.fetch_ticker(ex_sym)
m = _coerce_float(ticker.get("mark"), ticker.get("last"))
if m is None:
info = ticker.get("info") or {}
m = _coerce_float(info.get("mark_price"), info.get("last"))
if m is not None and m > 0:
return float(m)
except Exception:
pass
p = get_price(symbol)
return float(p) if p is not None else None
# 获取5分钟K线收盘价
def get_5m_close(symbol):
try: