update
This commit is contained in:
parent
8fcf262aee
commit
dfb0eb9477
@ -324,6 +324,7 @@ class PaperTradingService:
|
||||
触发的订单结果列表(包括挂单激活和平仓结果)
|
||||
"""
|
||||
triggered = []
|
||||
activated_order_ids = set() # 记录本轮刚激活的订单,避免立即检查止盈止损
|
||||
|
||||
# 1. 检查挂单是否触发入场
|
||||
pending_orders = [
|
||||
@ -334,12 +335,14 @@ class PaperTradingService:
|
||||
result = self._check_pending_entry(order, current_price)
|
||||
if result:
|
||||
triggered.append(result)
|
||||
activated_order_ids.add(order.order_id)
|
||||
logger.info(f"挂单触发入场: {order.order_id} | {symbol} @ ${current_price:,.2f}")
|
||||
|
||||
# 2. 检查持仓订单是否触发止盈止损
|
||||
# 2. 检查持仓订单是否触发止盈止损(跳过本轮刚激活的订单)
|
||||
open_orders = [
|
||||
order for order in self.active_orders.values()
|
||||
if order.symbol == symbol and order.status == OrderStatus.OPEN
|
||||
and order.order_id not in activated_order_ids
|
||||
]
|
||||
for order in open_orders:
|
||||
result = self._check_order_trigger(order, current_price)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user