a
This commit is contained in:
parent
be6459d5dd
commit
51fd3c6550
|
|
@ -2814,7 +2814,7 @@ class PositionManager:
|
||||||
partial_profit_taken = position_info.get('partialProfitTaken', False)
|
partial_profit_taken = position_info.get('partialProfitTaken', False)
|
||||||
remaining_quantity = position_info.get('remainingQuantity', quantity)
|
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 not partial_profit_taken and take_profit_1 is not None:
|
||||||
# 计算第一目标对应的保证金百分比
|
# 计算第一目标对应的保证金百分比
|
||||||
if position_info['side'] == 'BUY':
|
if position_info['side'] == 'BUY':
|
||||||
|
|
@ -2826,9 +2826,10 @@ class PositionManager:
|
||||||
# 直接比较当前盈亏百分比与第一目标(基于保证金)
|
# 直接比较当前盈亏百分比与第一目标(基于保证金)
|
||||||
if pnl_percent_margin >= take_profit_1_pct_margin:
|
if pnl_percent_margin >= take_profit_1_pct_margin:
|
||||||
logger.info(
|
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"当前盈亏={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%
|
# 部分平仓50%
|
||||||
partial_quantity = quantity * 0.5
|
partial_quantity = quantity * 0.5
|
||||||
|
|
@ -2860,7 +2861,7 @@ class PositionManager:
|
||||||
position_info['stopLoss'] = entry_price
|
position_info['stopLoss'] = entry_price
|
||||||
logger.info(
|
logger.info(
|
||||||
f"{symbol} [实时监控] 部分止盈后:剩余仓位止损移至成本价 {entry_price:.4f}(保本),"
|
f"{symbol} [实时监控] 部分止盈后:剩余仓位止损移至成本价 {entry_price:.4f}(保本),"
|
||||||
f"剩余50%仓位追求4.0:1止盈目标(山寨币策略:追求大赢家)"
|
f"剩余50%仓位追求更高收益(第二目标:4.0:1盈亏比或更高)"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"{symbol} [实时监控] 部分止盈失败: {e}")
|
logger.error(f"{symbol} [实时监控] 部分止盈失败: {e}")
|
||||||
|
|
|
||||||
|
|
@ -452,8 +452,8 @@ class TradeRecommender:
|
||||||
else:
|
else:
|
||||||
stop_loss_pct = (stop_loss_price - entry_price) / entry_price
|
stop_loss_pct = (stop_loss_price - entry_price) / entry_price
|
||||||
|
|
||||||
# 第一目标:盈亏比1:1(快速锁定利润,设置保本损)
|
# 第一目标:30%固定止盈(基于保证金),保证拿到30%盈利,然后留一部分去追求更高利润
|
||||||
take_profit_1_pct_margin = stop_loss_pct_margin * 1.0
|
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(
|
take_profit_1 = self.risk_manager.get_take_profit_price(
|
||||||
entry_price, direction, estimated_quantity, leverage,
|
entry_price, direction, estimated_quantity, leverage,
|
||||||
take_profit_pct=take_profit_1_pct_margin
|
take_profit_pct=take_profit_1_pct_margin
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user