a
This commit is contained in:
parent
16c4cfbdd8
commit
8e365b3a9a
|
|
@ -2698,6 +2698,10 @@ class PositionManager:
|
||||||
if pnl_percent_margin > position_info.get('maxProfit', 0):
|
if pnl_percent_margin > position_info.get('maxProfit', 0):
|
||||||
position_info['maxProfit'] = pnl_percent_margin
|
position_info['maxProfit'] = pnl_percent_margin
|
||||||
|
|
||||||
|
# ⚠️ 2026-01-27修复:提前初始化partial_profit_taken,避免在止损检查时未定义
|
||||||
|
partial_profit_taken = position_info.get('partialProfitTaken', False)
|
||||||
|
remaining_quantity = position_info.get('remainingQuantity', quantity)
|
||||||
|
|
||||||
# 移动止损逻辑(盈利后保护利润,基于保证金)
|
# 移动止损逻辑(盈利后保护利润,基于保证金)
|
||||||
# 每次检查时从Redis重新加载配置,确保配置修改能即时生效
|
# 每次检查时从Redis重新加载配置,确保配置修改能即时生效
|
||||||
try:
|
try:
|
||||||
|
|
@ -2863,8 +2867,7 @@ class PositionManager:
|
||||||
should_close = False
|
should_close = False
|
||||||
take_profit_1 = position_info.get('takeProfit1') # 第一目标(盈亏比1:1)
|
take_profit_1 = position_info.get('takeProfit1') # 第一目标(盈亏比1:1)
|
||||||
take_profit_2 = position_info.get('takeProfit2', position_info.get('takeProfit')) # 第二目标(1.5:1)
|
take_profit_2 = position_info.get('takeProfit2', position_info.get('takeProfit')) # 第二目标(1.5:1)
|
||||||
partial_profit_taken = position_info.get('partialProfitTaken', False)
|
# ⚠️ 注意:partial_profit_taken和remaining_quantity已在方法开头初始化,这里不需要重复定义
|
||||||
remaining_quantity = position_info.get('remainingQuantity', quantity)
|
|
||||||
|
|
||||||
# 第一目标:30%固定止盈(基于保证金),了结50%仓位,保证拿到30%盈利
|
# 第一目标:30%固定止盈(基于保证金),了结50%仓位,保证拿到30%盈利
|
||||||
if not partial_profit_taken and take_profit_1 is not None:
|
if not partial_profit_taken and take_profit_1 is not None:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user