This commit is contained in:
薇薇安 2026-01-26 16:22:18 +08:00
parent be6459d5dd
commit 51fd3c6550
2 changed files with 7 additions and 6 deletions

View File

@ -2814,7 +2814,7 @@ class PositionManager:
partial_profit_taken = position_info.get('partialProfitTaken', False)
remaining_quantity = position_info.get('remainingQuantity', quantity)
# 第一目标:盈亏比1:1了结50%仓位
# 第一目标:30%固定止盈基于保证金了结50%仓位保证拿到30%盈利
if not partial_profit_taken and take_profit_1 is not None:
# 计算第一目标对应的保证金百分比
if position_info['side'] == 'BUY':
@ -2826,9 +2826,10 @@ class PositionManager:
# 直接比较当前盈亏百分比与第一目标(基于保证金)
if pnl_percent_margin >= take_profit_1_pct_margin:
logger.info(
f"{symbol} [实时监控] 触发第一目标止盈(亏比1:1,基于保证金): "
f"{symbol} [实时监控] 触发第一目标止盈(30%固定止盈,基于保证金): "
f"当前盈亏={pnl_percent_margin:.2f}% of margin >= 目标={take_profit_1_pct_margin:.2f}% of margin | "
f"当前价={current_price_float:.4f}, 目标价={take_profit_1:.4f}"
f"当前价={current_price_float:.4f}, 目标价={take_profit_1:.4f} | "
f"将平掉50%仓位锁定30%盈利剩余50%追求更高收益"
)
# 部分平仓50%
partial_quantity = quantity * 0.5
@ -2860,7 +2861,7 @@ class PositionManager:
position_info['stopLoss'] = entry_price
logger.info(
f"{symbol} [实时监控] 部分止盈后:剩余仓位止损移至成本价 {entry_price:.4f}(保本),"
f"剩余50%仓位追求4.0:1止盈目标山寨币策略追求大赢家"
f"剩余50%仓位追求更高收益第二目标4.0:1盈亏比或更高"
)
except Exception as e:
logger.error(f"{symbol} [实时监控] 部分止盈失败: {e}")

View File

@ -452,8 +452,8 @@ class TradeRecommender:
else:
stop_loss_pct = (stop_loss_price - entry_price) / entry_price
# 第一目标:盈亏比1:1快速锁定利润设置保本损
take_profit_1_pct_margin = stop_loss_pct_margin * 1.0
# 第一目标:30%固定止盈基于保证金保证拿到30%盈利,然后留一部分去追求更高利润
take_profit_1_pct_margin = config.TRADING_CONFIG.get('TAKE_PROFIT_PERCENT', 0.30) # 30%固定止盈
take_profit_1 = self.risk_manager.get_take_profit_price(
entry_price, direction, estimated_quantity, leverage,
take_profit_pct=take_profit_1_pct_margin