fix(mse): include buy+sell commission in sell target price

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 <noreply@anthropic.com>
This commit is contained in:
Mukan Erkin TÖRÜK 2026-04-25 12:58:26 +03:00
parent 8804824199
commit df9b85e3c6
2 changed files with 4 additions and 4 deletions

View file

@ -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);

View file

@ -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
? `<span class="${pnl >= 0 ? 'c-green' : 'c-red'}">${pnl >= 0 ? '+' : ''}${pnl.toFixed(2)}%</span>`