Skip to content

Instantly share code, notes, and snippets.

@quantra-go-algo
Created August 28, 2024 20:37
Show Gist options
  • Save quantra-go-algo/5c5d25db48d218c01fc330aae29272e4 to your computer and use it in GitHub Desktop.
Save quantra-go-algo/5c5d25db48d218c01fc330aae29272e4 to your computer and use it in GitHub Desktop.
# Plot the both buy-and-hold and the strategy cumulative returns
ggplot(data=df_forecasts, aes(x = date)) +
geom_line(aes(y = var_stra_cum_returns, color="VAR")) +
geom_line(aes(y = tvp_var_sv_stra_cum_returns, color="TVP-VAR-SV")) +
geom_line(aes(y = bnh_cum_returns,color="B&H")) +
geom_line(aes(y = stra_improved_cum_returns, color="Improved TVP-VAR-SV")) +
ggtitle("Buy and Hold and Strategies' Cumulative Returns") + xlab("Date") + ylab("Returns") +
theme(plot.title = element_text(hjust = 0.5, size=25), legend.position="bottom", legend.text = element_text(size=20)) +
scale_x_date(date_labels = "%b %y") +
theme(
axis.title.x = element_text(size = 20),
axis.text.x = element_text(size = 20),
axis.title.y = element_text(size = 20),
axis.text.y = element_text(size = 20),)
ggsave("strategies-cumulative-returns.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment