SIGN IN SIGN UP

Skip redundant candle re-store and duplicate position lookup per minute

- _simulate_price_change_effect: only re-add the real candle to storage
  when at least one order actually executed (i.e. partial candles were
  written that need to be overwritten). When nothing executed, the
  caller (_step_simulator) added this exact candle object immediately
  before, so the second add_candle was a byte-for-byte no-op rewrite —
  this removes ~260K of the 527K add_candle calls in a 6-month backtest.
- _check_for_liquidations: accept the already-fetched position to avoid
  a second get_position per minute (falls back to fetching when not
  provided, e.g. from the skip-simulator path).
- _get_fixed_jumped_candle: hoist repeated element reads; replace
  min/max with conditional writes (same values written).

Bench: a_simple_1h step 3.05s -> 2.31s (-24%; -56.7% vs baseline 5.33s),
b_heavy_15m step 14.65s -> 12.17s (-24.8% vs baseline 16.17s).
Fingerprints cc8ab0d73d50ae16 / 760596ae71bcce7b identical to baseline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
S
Saleh Mir committed
30dcc470d3026df4e3b5fac327893374ddbf92c2
Parent: 5dfa632