Fix fee tier recalculation for historical backtests

Server: recalc endpoint now checks HISTORICAL_DIR as fallback
when file not found in BACKTEST_DIR. Previously historical backtests
returned "not found" on recalc.

Frontend: renderBTDetail now accepts pnl_net/pnl_net_pct from
recalc response (the endpoint returns pnl_net not pnl).

Verified: VIP 0 → VIP 6 on OBI historical backtest changes
net PnL from 54.31% to 66.57% with fees dropping $18.10 → $5.85.
This commit is contained in:
ramseshk
2026-08-04 08:56:22 +00:00
parent f1c2d367a0
commit b47948b604
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -306,8 +306,8 @@ function onFeeTierChange(){
// ═══════════ Render backtest detail with fee toggle ──
function renderBTDetail(full){
var pnl=feeOn?(full.pnl||0):(full.pnl_gross||full.pnl||0);
var pnlPct=feeOn?(full.pnl_pct||0):(full.pnl_gross_pct||full.pnl_pct||0);
var pnl=feeOn?(full.pnl_net||full.pnl||0):(full.pnl_gross||full.pnl||0);
var pnlPct=feeOn?(full.pnl_net_pct||full.pnl_pct||0):(full.pnl_gross_pct||full.pnl_pct||0);
var fees=full.fees_total||0;
var strat=full.strategy||'';
document.getElementById('det-name').textContent=strat+(feeOn?' (net of fees)':' (gross, no fees)');