[R-SIG-Finance] Continuous futures series with R

Whit Armstrong armstrong.whit at gmail.com
Fri Jul 31 14:29:01 CEST 2009

if you have high quality data (i.e. no missing vol and oi data), then
the problem isn't difficult.

I'm not sure what the case is with IB, but quite a few futures data
providers have very spotty data then you have to write a lot of code
to deal with the bad data.

typical problems that I've seen from our data provider are:
1) future contracts that do not overlap in time
2) OI data that is missing for some or all contracts
3) OI data that is represented as the total OI for all contracts (but
appended to each contract)
4) contracts that were trading but not the active contract that have
data on holidays (but the active contract doesn't have this date).
This is a problem b/c to create the scratch space for the continuous
series the easiest way to calc the total rows is
unique(unlist(lapply(x,dates))), so you wind up with extra dates b/c
of the bad data.

I have a package for this that's not quite complete.  I'll post it to
github shortly.


On Fri, Jul 31, 2009 at 7:45 AM, Mark Breman<breman.mark at gmail.com> wrote:
> Hi Brian,
> Yes I think you are right; the roll strategy can differ for different types
> of continuous contracts.
> I think that Ideally you would have a function/package that:
> 1) allows the creation of the continuous series to be based on a specified
> roll strategy
> 2) it should be data-source independant (thus expiration dates should also
> be specified)
> The problem I face is that my current data provider (IB) does not offer
> continuous contracts...
> Regards,
> -Mark-
> 2009/7/31 Brian G. Peterson <brian at braverock.com>
>> Mark Breman wrote:
>>> Hi,
>>> I have been looking for existing R code to create a continuous futures
>>> series from individual futures contract series, but have not found
>>> anything
>>> (yet).
>>> Is there really nothing out there?
>>> Kind regards,
>> Mark,
>> I think the biggest issue is that the roll can happen on any number of
>> different criteria.  Volume Cross, Midpoint Roll, Date (expiration-n) Roll,
>> some other method, etc.  Also, any data provider that you're already paying
>> for data (Bloomberg, Reuters, CQG, QAI, etc.) will already have one or more
>> continuous series methods available, making the potential R code even less
>> useful, and probably specific to one data provider.
>> Another problem would be instrument/contract descriptors through time,
>> though this seems minor, R does not yet have an instrument model for
>> reference data, though we're working on that.
>> Can you be a little more explicit about what you are trying to do?  data
>> source/provider, roll method, etc?
>> Regards,
>>   - Brian
>> --
>> Brian G. Peterson
>> http://braverock.com/brian/
>> Ph: 773-459-4973
>> IM: bgpbraverock
>        [[alternative HTML version deleted]]
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.

More information about the R-SIG-Finance mailing list