Last active
November 5, 2021 09:15
-
-
Save dkav6/8ca8be19e3e1c81feb835c5e0e00f14d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = get_data('ETH-USD') | |
df = df/1000 | |
strategies = [SmaCross, EmaCross, WmaCross] | |
all_runs = [] | |
for strategy in strategies: | |
bt = Backtest(df, strategy, cash=100, commission=.002) | |
stats = bt.optimize(n1=range(5, 90, 5), | |
n2=range(10, 120, 5), | |
maximize='Return (Ann.) [%]', | |
constraint=lambda param: param.n1 < param.n2) | |
all_runs.append(stats) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment