Skip to content

Instantly share code, notes, and snippets.

@mbusigin
Last active January 1, 2016 03:49
Show Gist options
  • Save mbusigin/8087626 to your computer and use it in GitHub Desktop.
Save mbusigin/8087626 to your computer and use it in GitHub Desktop.
Plotting performance barcharts
library(quantmod)
library(PerformanceAnalytics)
# getSymbols(c("SPY", "TLT", "LQD"))
bars = 60
a = merge(Delt(SPY[,6], k=bars), Delt(TLT[,6], k=bars), Delt(LQD[,6], k=bars))
b = last(a)
names(b) = c("SPY", "TLT", "LQD")
b2 = round(as.vector(b), digits=2)
barplot( b2, names.arg=names(b) )
text(1:3, 0, paste(b2, "%", sep=""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment