feat: 盈亏比与亏损额度展示,市价FAK报单,修复止盈止损保存失败

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 14:33:05 +08:00
parent 367f32dd82
commit 63beda3c71
5 changed files with 125 additions and 88 deletions
+4 -2
View File
@@ -825,10 +825,11 @@ class CtpBridge:
raise ValueError(f"未知开平: {offset}")
use_market = (order_type or "limit").lower() == "market"
ot = OrderType.LIMIT
if use_market:
ot = OrderType.FAK
price = self._aggressive_limit_price(ths_code, sym, ex_name, d, tick, price)
else:
ot = OrderType.LIMIT
price = round_to_tick(float(price), tick)
if price <= 0:
raise ValueError("委托价格无效,请检查行情或手动填写价格")
@@ -929,7 +930,8 @@ def ctp_get_account(mode: str) -> dict[str, Any]:
def ctp_list_positions(mode: str, *, refresh_if_empty: bool = True) -> list[dict[str, Any]]:
b = get_bridge()
b.ensure_connected(mode)
if b.connected_mode != mode or not b.ping():
return []
return b.list_positions(refresh_if_empty=refresh_if_empty)