Replies: 1 comment
-
Have you tried computing the spread by subtracting bids from asks ( Alternatively, you can try: ohlc_cols = ['Open', 'High', 'Low', 'Close']
df_spread[ohlc_cols] += df_spread[ohlc_cols].min() + eps
assert (df_spread[ohlc_cols] > 0).all().all() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
I'm looking to build a strategy to trade spreads (FX, futures, ...), by first calculating the spread (for each security, open minus open, high minus high, etc. ). This may result in negative values (see screenshot below).
When I try to run the backtest, I get an error for negative equity (even after setting initial cash in the range of billions).
Is there a way to work this issue around using Backtesting.py? Or is there any alternative that allows for that?
Please let me know,
Thank you
Beta Was this translation helpful? Give feedback.
All reactions