fix: ctp_list_positions pass refresh_margin to fix empty positions

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 15:09:23 +08:00
parent 4d60b958ce
commit 12a30d4f0c
+7 -2
View File
@@ -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]]: