From 12a30d4f0c02b8369e8e38d1064e0f4320eb5d0d Mon Sep 17 00:00:00 2001 From: dekun Date: Thu, 25 Jun 2026 15:09:23 +0800 Subject: [PATCH] fix: ctp_list_positions pass refresh_margin to fix empty positions Co-authored-by: Cursor --- vnpy_bridge.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vnpy_bridge.py b/vnpy_bridge.py index faf7d20..51494ef 100644 --- a/vnpy_bridge.py +++ b/vnpy_bridge.py @@ -1027,11 +1027,16 @@ def ctp_get_account(mode: str) -> dict[str, Any]: return b.get_account() -def ctp_list_positions(mode: str, *, refresh_if_empty: bool = True) -> list[dict[str, Any]]: +def ctp_list_positions( + mode: str, + *, + refresh_if_empty: bool = True, + refresh_margin: bool = False, +) -> list[dict[str, Any]]: b = get_bridge() if b.connected_mode != mode or not b.ping(): return [] - return b.list_positions(refresh_if_empty=refresh_if_empty) + return b.list_positions(refresh_if_empty=refresh_if_empty, refresh_margin=refresh_margin) def ctp_list_active_orders(mode: str) -> list[dict[str, Any]]: