diff --git a/scripts/replay_paper_trades.py b/scripts/replay_paper_trades.py index b006983..30367b0 100644 --- a/scripts/replay_paper_trades.py +++ b/scripts/replay_paper_trades.py @@ -217,6 +217,11 @@ def replay_trade(cur, tid, symbol, direction, strategy, entry_ts, atr): result_exit_ts = timeout_ts result_exit_price = exit_price + # 扣手续费: fee_r = 2 * taker_rate * entry / rd(开仓+平仓各一次) + PAPER_FEE_RATE = 0.0005 + fee_r = 2 * PAPER_FEE_RATE * entry / rd if rd > 0 else 0 + result_pnl_r -= fee_r + return { 'id': tid, 'entry': entry, @@ -241,6 +246,7 @@ def main(dry_run=False): SELECT id, symbol, direction, strategy, entry_ts, atr_at_entry FROM paper_trades WHERE atr_at_entry > 0 + AND status NOT IN ('active', 'tp1_hit') ORDER BY id ASC """) trades = cur.fetchall()