feat: trend pullback preview TP per DCA leg with unified stop loss across exchanges

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-05 16:10:27 +08:00
parent 674d721072
commit 31756e838d
7 changed files with 292 additions and 23 deletions
+3 -7
View File
@@ -1093,15 +1093,11 @@ def load_trend_page_context(conn, request_obj, cfg: dict) -> dict[str, Any]:
).fetchone()
now_ms = int(time.time() * 1000)
if pr and int(pr["expires_at_ms"] or 0) >= now_ms:
from strategy_trend_lib import build_trend_preview_level_rows
trend_preview = _row(cfg, pr)
preview_expires_ms = int(pr["expires_at_ms"])
try:
grid = json.loads(trend_preview.get("grid_prices_json") or "[]")
legs = json.loads(trend_preview.get("leg_amounts_json") or "[]")
except Exception:
grid, legs = [], []
for i, pair in enumerate(zip(grid, legs), 1):
trend_preview_levels.append({"i": i, "price": pair[0], "contracts": pair[1]})
trend_preview, trend_preview_levels = build_trend_preview_level_rows(trend_preview)
elif pr:
trend_preview_expired = True
return {