Report open interest window min and max in get_derivatives

This commit is contained in:
eezd committed 2026-10-14 19:19:23 +08:00
1 parent 3e5db79d4e
commit 5b7490ac48
1 file changed
+2
+2
View File
@@ -271,6 +271,8 @@ async def open_interest_part(symbol: str, period: str, limit: int) -> dict:
return { return {
"latest_contracts": float(last["sumOpenInterest"]), "latest_value_usdt": round(float(last["sumOpenInterestValue"])), "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_change_pct": pct(float(last["sumOpenInterest"]) / float(first["sumOpenInterest"]) - 1),
# 由持仓价值 / 持仓量推算的同窗口价格变化,用于对照持仓量与价格的方向 # 由持仓价值 / 持仓量推算的同窗口价格变化,用于对照持仓量与价格的方向
"window_price_change_pct": pct(price(last) / price(first) - 1), "window_price_change_pct": pct(price(last) / price(first) - 1),