fix: limit order по bid/ask, partial fill, maker fee в бэктесте

- exchange: limit по bid (buy) / ask (sell) вместо last price
- exchange: partial fill handling при cancel limit order
- backtest_wf: MAKER_FEE + TAKER_FEE вместо TAKER_FEE * 2
- sweep_leverage/sweep_stop: аналогично maker+taker

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
anor
2026-03-13 20:05:03 +10:00
co-authored by Claude Opus 4.6
parent 921defad30
commit 096a361584
4 changed files with 32 additions and 11 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ import numpy as np
import pandas as pd
from backtest_wf import (
INITIAL_CAPITAL, OR_MINUTES, TAKER_FEE, TIMEFRAME, TRAIN_RATIO,
INITIAL_CAPITAL, MAKER_FEE, OR_MINUTES, TAKER_FEE, TIMEFRAME, TRAIN_RATIO,
_run_on_dates, compute_metrics, find_best_params,
)
from data import fetch_candles
@@ -43,7 +43,7 @@ def trades_to_pnl(trades, capital, risk_pct, leverage):
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({