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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20140928/fb364775/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StructArb.png
Type: image/png
Size: 29654 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20140928/fb364775/attachment.png>
Converting to weekly timestamps removes years from chart.TimeSeries (and its extensions)
4 messages · Brian G. Peterson, Joshua Ulrich, Ilya Kipnis
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
I get a very reasonable chart and axis when I run your code in a clean session. The years aren't simply cut off the x-axis labels, all the "months" are "Aug" and the grid lines extend beyond the edges of the plots. I think something is funky with your R session. -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com
On Sun, Sep 28, 2014 at 8:40 PM, Ilya Kipnis <ilya.kipnis at gmail.com> 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
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Well, this is really irritating. I just loaded up dplyr and suddenly got those same issues, but when I didn't have it loaded, everything went smoothly. Very strange. On Sun, Sep 28, 2014 at 10:22 PM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
I get a very reasonable chart and axis when I run your code in a clean session. The years aren't simply cut off the x-axis labels, all the "months" are "Aug" and the grid lines extend beyond the edges of the plots. I think something is funky with your R session. -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com On Sun, Sep 28, 2014 at 8:40 PM, Ilya Kipnis <ilya.kipnis at gmail.com> 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
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.