From df9b85e3c6b54bdb51d9d42a6d31b8e74c4a9f05 Mon Sep 17 00:00:00 2001 From: Mukan Erkin Date: Sat, 25 Apr 2026 12:58:26 +0300 Subject: [PATCH] fix(mse): include buy+sell commission in sell target price MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sell_price now = buy_price × (1 + (profit_percent + 0.2) / 100) so the configured profit_percent is truly net after both sides' 0.1% fees. PnL display uses real buy commission from fills, fixed 0.1% for sell side. Co-Authored-By: Claude Sonnet 4.6 --- src/bot/strategy.rs | 3 ++- src/web/bot.html | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bot/strategy.rs b/src/bot/strategy.rs index 7e50e5a..fac9b46 100644 --- a/src/bot/strategy.rs +++ b/src/bot/strategy.rs @@ -62,7 +62,8 @@ impl RedCandleStrategy { symbol, buy_order.price, filters.format_qty(buy_order.quantity), buy_order.order_id ); - let sell_price = buy_order.price * (1.0 + profit_percent / 100.0); + // +0.2: alış (%0.1) + satış (%0.1) komisyonları dahil, net kar = profit_percent + let sell_price = buy_order.price * (1.0 + (profit_percent + 0.2) / 100.0); let sell_price_str = filters.format_price(sell_price); let sell_quantity = filters.format_qty(buy_order.quantity); diff --git a/src/web/bot.html b/src/web/bot.html index ab3b182..c468540 100644 --- a/src/web/bot.html +++ b/src/web/bot.html @@ -628,9 +628,8 @@ function renderOpenTable() { const buyCommissionPct = p.buy_commission_usdt > 0 ? (p.buy_commission_usdt / (p.buy_price * p.quantity) * 100) : 0.1; - // satış komisyonu tahmini: aynı oran üzerinden (currentPrice × quantity için) - const sellCommissionPct = buyCommissionPct; - pnl = grossPnl - buyCommissionPct - sellCommissionPct; + // satış komisyonu: sabit %0.1 (BNB olmasa da güvende olalım) + pnl = grossPnl - buyCommissionPct - 0.1; } const pnlHtml = pnl !== null ? `${pnl >= 0 ? '+' : ''}${pnl.toFixed(2)}%`