From 5b7490ac48ae727bca38a6963128c4183cd09342 Mon Sep 17 00:00:00 2001 From: eezd Date: Wed, 14 Oct 2026 19:19:23 +0800 Subject: [PATCH] Report open interest window min and max in get_derivatives --- backend/src/alphapulse/ai/tools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/alphapulse/ai/tools.py b/backend/src/alphapulse/ai/tools.py index d867a99..55674c2 100644 --- a/backend/src/alphapulse/ai/tools.py +++ b/backend/src/alphapulse/ai/tools.py @@ -271,6 +271,8 @@ async def open_interest_part(symbol: str, period: str, limit: int) -> dict: return { "latest_contracts": float(last["sumOpenInterest"]), "latest_value_usdt": round(float(last["sumOpenInterestValue"])), + "window_min_contracts": min(float(r["sumOpenInterest"]) for r in rows), + "window_max_contracts": max(float(r["sumOpenInterest"]) for r in rows), "window_change_pct": pct(float(last["sumOpenInterest"]) / float(first["sumOpenInterest"]) - 1), # 由持仓价值 / 持仓量推算的同窗口价格变化,用于对照持仓量与价格的方向 "window_price_change_pct": pct(price(last) / price(first) - 1),