-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
How to add slippage? #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Slippage can greatly affect returns |
Would something like this work? SPREAD = .0002
SLIPPAGE = .0001
...
bt = Backtest(..., commission=SPREAD + SLIPPAGE) |
good idea, well, commission can add this slippage percent,but can not set fixed value |
Related issue: #113. |
Closed
How would be to add the a random variable during the
Here is the basic idea: import numpy as np
slippage_probability = 0.25
slippage_range = (0.98, 1.03)
close = 105
if np.random.rand() < slippage_probability:
close *= np.random.uniform(slippage_range[0], slippage_range[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
https://www.backtrader.com/docu/slippage/slippage/
backtrader can set a slippage via percentage or fixed value like 0.01
Actual Behavior
not a feature
thinking about this feature please?
The text was updated successfully, but these errors were encountered: