Skip to content

Instantly share code, notes, and snippets.

@HumanRupert
Last active June 11, 2021 15:27
Show Gist options
  • Save HumanRupert/768a3f175cf98e443f32b19da93a027f to your computer and use it in GitHub Desktop.
Save HumanRupert/768a3f175cf98e443f32b19da93a027f to your computer and use it in GitHub Desktop.
# 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