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:
@@ -204,6 +204,8 @@ async def get_backtest(name: str):
|
||||
async def recalc_backtest(name: str, fee_tier: int = 0, staking_tier: str = "none"):
|
||||
"""Recalculate backtest PnL with different fee tier."""
|
||||
fpath = os.path.join(BACKTEST_DIR, f"{name}.json")
|
||||
if not os.path.exists(fpath):
|
||||
fpath = os.path.join(HISTORICAL_DIR, f"{name}.json")
|
||||
if not os.path.exists(fpath):
|
||||
return JSONResponse({"error": "not found"}, status_code=404)
|
||||
with open(fpath) as f:
|
||||
|
||||
Reference in New Issue
Block a user