Last active
June 11, 2021 15:27
-
-
Save HumanRupert/768a3f175cf98e443f32b19da93a027f 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
# format start end | |
to_localized_ts = lambda dt: pd.Timestamp(dt).tz_localize("UTC") | |
start, end = to_localized_ts(START), to_localized_ts(END) | |
# get returns | |
benchmark = get_benchmark_returns() | |
# run strat | |
results = zp.run_algorithm( | |
start=start, | |
end=end, | |
initialize=initialize, | |
handle_data=handle_data, | |
benchmark_returns=benchmark, | |
capital_base=CAPITAL_BASE, | |
bundle='quandl', | |
data_frequency='daily') | |
# analyze results | |
analyze(results, benchmark) | |
# store results to CSV | |
results.to_csv("results.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment