[R-SIG-Finance] rbind and duplicates in monthly futures
peter.neumaier at gmail.com
Thu Apr 7 13:25:28 CEST 2016
I agree, I could have been more explicit about the nature of my problem and
the specific issue arising from the decision of
when/how to roll futures contracts.
However, I was hoping for a workaround within the quantstrat framework that
might help me. My research shows
that the last six weeks of my traded contract are the most liquid period
over lifetime. As a result, I end up wth an overlap of two
weeks, where in practical terms I would be trading two contracts: the
actual frontmonth and the following month.
Currently, I am backtesting each contract separately, ending up with
monthly output, which is not 100% satisfying as I'd like to
evaluate the yearly performance and not look into monthly output.
Is there a way to overcome the issue of overlapping periods, i.e. run the
data for the actual frontmonth (six weeks) and continue thereafter
with the overlap period, essentially forcing sequential execution of the
time series instead of merging the two months and mix
the data during the overlap period? I hope I am not confusing you further.
On Thu, Apr 7, 2016 at 1:57 AM, Joshua Ulrich <josh.m.ulrich at gmail.com>
> On Tue, Apr 5, 2016 at 3:06 PM, Peter Neumaier <peter.neumaier at gmail.com>
> > Hi all, in the interim I've managed to import the halfhourly data, cast
> to a
> > matrix, then rbind the two months
> > and convert to XTS for later use by my algo strategy.
> > I am wondering how the data overlap will be treated by the quantstrat
> > framework and how
> > it might be impacting the calculations (i.e. P&L during overlaps).
> It wasn't clear to me from your original question, but I can now see
> that you want to create a single continuous futures series using
> adjacent futures contracts. As you probably guessed, the overlap in
> data in your APR_MAY object would be very bad.
> There is not a single correct way to create a continuous futures
> series for every futures market. You could roll to the next contract
> when the current contract expires, when volume or open interest in the
> current contract drops below some threshold over the next contract's
> volume or open interest, etc.
> I realize this doesn't completely answer your question... because your
> question is not just about programming. It's also about the
> microstructure of the market you're researching. Searching for
> "continuous futures" or "futures roll" should help give you some ideas
> about how to solve the problem for this specific futures market.
> > Below the files and the code I am using:
> > APR <-
> > as.matrix(read.zoo("NGF201404_6weeks30mins.csv",sep=",",tz="",header=T))
> > MAY <-
> > as.matrix(read.zoo("NGF201405_6weeks30mins.csv",sep=",",tz="",header=T))
> > APR_MAY <- as.xts(rbind(APR,MAY))
> > http://tempsend.com/BBA86DB4ED
> > http://tempsend.com/0EDA07753B
> > Thanks
> > Peter
> > On Mon, Apr 4, 2016 at 2:30 PM, Joshua Ulrich <josh.m.ulrich at gmail.com>
> > wrote:
> >> On Mon, Apr 4, 2016 at 7:24 AM, Peter Neumaier <
> peter.neumaier at gmail.com>
> >> wrote:
> >> > Hi all, I am trying to rbind monthly futures to a continuous time
> >> > to
> >> > be run through an algo strategy. The problem here is that data is
> >> > overlapping, i.e. my Feb contract trades for 6 weeks and when I rbind
> >> > with
> >> > my March data I get an overlap for last two weeks of Jan.
> >> >
> >> > How can I create a time series that is continuous, not overlapping and
> >> > useable in quantstrat (i.e. XTS format)? I am not posting any code as
> >> > would be really one single rbind statement.
> >> >
> >> Even though the code may be simple, you still would be more likely to
> >> receive help if you provide a minimal reproducible example of the
> >> issue. In this case, the data are not simple, and most people will
> >> not take the time to construct sample data in order to attempt to
> >> reproduce the issue you describe.
> >> > Thanks
> >> > Peter
> >> >
> >> > [[alternative HTML version deleted]]
> >> >
> >> > _______________________________________________
> >> > 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
> >> > should go.
> >> --
> >> Joshua Ulrich | about.me/joshuaulrich
> >> FOSS Trading | www.fosstrading.com
> >> R/Finance 2016 | www.rinfinance.com
> Joshua Ulrich | about.me/joshuaulrich
> FOSS Trading | www.fosstrading.com
> R/Finance 2016 | www.rinfinance.com
[[alternative HTML version deleted]]
More information about the R-SIG-Finance