Skip to content

Enhancement #1300: Allow spread to be a dynamic sequence per candle - #1408

Open
dwaddle wants to merge 1 commit into
kernc:masterfrom
dwaddle:fix-1300-dynamic-spread
Open

dwaddle wants to merge 1 commit into
kernc:masterfrom
dwaddle:fix-1300-dynamic-spread

Conversation

@dwaddle

@dwaddle dwaddle commented Sep 9, 2026

Copy link
Copy Markdown

Resolves #1300

Enhancement description

This PR removes the strict requirement that spread must be a static float. It modifies Backtest.__init__ and _Broker so that spread can be passed as a sequence (like a Pandas Series or Numpy Array) that matches the length of the dataframe.

This enables variable spreads per candle, which is much more realistic for backtesting through high-volatility events like NFP or earnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spread is Float but spread is typically different per row of the OHLC dataframe

1 participant