[R-SIG-Finance] Converting to weekly timestamps removes years from chart.TimeSeries (and its extensions)

Brian G. Peterson brian at braverock.com
Mon Sep 29 04:05:18 CEST 2014


maybe RTFM?

if you follow the seeAlso links in the pdf or online help, you'll find

?chart.TimeSeries

see

data.format


charts.PerformanceSummary(portfRets,date.format="%m/%y")




On 09/28/2014 08:40 PM, Ilya Kipnis wrote:
> So something that just irritated me is this:
>
> I'm replicating a strategy that uses weekly rebalancing, but when I go
> to plot the equity curve, the years cut off on the x axis, which looks
> weird.
>
> Here's my code:
>
> require(quantstrat)
>
> #long TLT 60%, leverage 3x to 180%, rebalance weekly, short VIX 40%
> getSymbols("^VIX", from="1990-01-01")
> getSymbols("TLT", from="1990-01-01")
> VIX <- to.weekly(OHLC(VIX), OHLC=TRUE)
> TLT <- to.weekly(OHLC(TLT), OHLC=TRUE)
> vixRets <- Cl(VIX)/Op(VIX)-1
> tltRets <- Cl(TLT)/Op(TLT)-1
> both <- merge(vixRets, tltRets, join='inner')
> colnames(both) <- c("VIX", "TLT")
> portfRets <- -.4*both$VIX+1.8*both$TLT
> colnames(portfRets) <- "VIXTLT"
> charts.PerformanceSummary(portfRets)
>
> Along with the attached picture.
>
> Any tips on how to get the years back into the x axis would be appreciated.
>
> Thanks.
>
> -Ilya



More information about the R-SIG-Finance mailing list