diff --git a/backtest_experiments.py b/backtest_experiments.py index 16a4870..df086b5 100644 --- a/backtest_experiments.py +++ b/backtest_experiments.py @@ -18,6 +18,7 @@ NY = ZoneInfo("America/New_York") INITIAL_CAPITAL = 1_000.0 RISK_PCT = 0.02 +MAKER_FEE = 0.0002 TAKER_FEE = 0.00055 LEVERAGE = 10 TRAIN_RATIO = 0.5 @@ -66,7 +67,7 @@ def trades_to_pnl(trades: list[Trade], capital: float) -> list[dict]: gross = pos_size * (t.exit_price - t.entry) else: gross = pos_size * (t.entry - t.exit_price) - commission = pos_value * TAKER_FEE * 2 + commission = pos_value * (MAKER_FEE + TAKER_FEE) pnl_net = gross - commission equity += pnl_net results.append({ diff --git a/backtest_leverage.py b/backtest_leverage.py index e784fe1..cf1d549 100644 --- a/backtest_leverage.py +++ b/backtest_leverage.py @@ -16,6 +16,7 @@ NY = ZoneInfo("America/New_York") INITIAL_CAPITAL = 1_000.0 RISK_PCT = 0.02 +MAKER_FEE = 0.0002 TAKER_FEE = 0.00055 TRAIN_RATIO = 0.5 TIMEFRAME = "5m" @@ -59,7 +60,7 @@ def trades_to_pnl(trades: list[Trade], capital: float, else: gross = pos_size * (t.entry - t.exit_price) - commission = pos_value * TAKER_FEE * 2 + commission = pos_value * (MAKER_FEE + TAKER_FEE) pnl_net = gross - commission # Liquidation check (simplified): loss > margin diff --git a/backtest_rolling.py b/backtest_rolling.py index 646f7a5..989031a 100644 --- a/backtest_rolling.py +++ b/backtest_rolling.py @@ -17,6 +17,7 @@ NY = ZoneInfo("America/New_York") INITIAL_CAPITAL = 1_000.0 RISK_PCT = 0.02 +MAKER_FEE = 0.0002 TAKER_FEE = 0.00055 LEVERAGE = 10 TRAIN_RATIO = 0.5 @@ -53,7 +54,7 @@ def trades_to_pnl(trades: list[Trade], capital: float) -> list[dict]: gross = pos_size * (t.exit_price - t.entry) else: gross = pos_size * (t.entry - t.exit_price) - commission = pos_value * TAKER_FEE * 2 + commission = pos_value * (MAKER_FEE + TAKER_FEE) pnl_net = gross - commission equity += pnl_net results.append({ diff --git a/test_live.py b/test_live.py index 44dda3e..93b9e57 100644 --- a/test_live.py +++ b/test_live.py @@ -191,7 +191,7 @@ def test_run_cycle_simulation(): gross = pos_size * (t.exit_price - t.entry) else: gross = pos_size * (t.entry - t.exit_price) - commission = pos_value * cfg.risk.taker_fee * 2 + commission = pos_value * (cfg.risk.maker_fee + cfg.risk.taker_fee) pnl = gross - commission print(f" [{now_ny.strftime('%H:%M')}] EXIT {t.direction.upper()} " f"@ ${t.exit_price:,.2f} ({t.result}) PnL ${pnl:+,.2f} [flash]")