Skip to content

Instantly share code, notes, and snippets.

@HumanRupert
Created June 11, 2021 15:10
Show Gist options
  • Save HumanRupert/94ec7dafae8d43f09b5c7ff21856bd82 to your computer and use it in GitHub Desktop.
Save HumanRupert/94ec7dafae8d43f09b5c7ff21856bd82 to your computer and use it in GitHub Desktop.
def get_benchmark_returns() -> pd.Series:
bench = yf.Ticker(BENCHMARK)
bench_hist = bench_hist.history(start=START, end=END, auto_adjust=True).tz_localize("UTC")
returns = pd.Series(bench_hist["Close"].pct_change().values, index=bench_hist.index).dropna()
returns.index.names = ["date"]
return returns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment