Skip to content

Instantly share code, notes, and snippets.

@quantra-go-algo
Created May 5, 2025 11:08
Show Gist options
  • Save quantra-go-algo/7f5bd5767425fbc605dbd2a4179eee3a to your computer and use it in GitHub Desktop.
Save quantra-go-algo/7f5bd5767425fbc605dbd2a4179eee3a to your computer and use it in GitHub Desktop.
# PLOT CUMULATIVE RETURNS
plt.figure(figsize=(14, 4))
plt.plot(df.index, df['cum_market'], label='Buy & Hold', linewidth=1)
plt.plot(df.index, df['cum_strategy'], label='Strategy', linewidth=1)
plt.title('Cumulative Returns: Strategy vs. Buy-and-Hold')
plt.xlabel('Date'); plt.ylabel('Cumulative Return')
plt.legend(); plt.grid(True); plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment