[R-SIG-Finance] Dealing with the futures roll in quantstrat and blotter

Brian G. Peterson brian at braverock.com
Mon Mar 14 16:35:24 CET 2011


On 03/14/2011 10:02 AM, Gei Lin wrote:
> Has anyone dealt with rolling futures in the quantstrat and blotter
> framework?

Yes,  we roll products manually.

The 'best' approach is probably to construct some sort of continuous 
series that implements whatever rules you use (roll calendar, volume 
cross, whatever).

Robert Sams wrote splicing functions, but they assume univariate data, 
and have not been ported to handle multi-column data (e.g. OHLC or TBBO 
data) for each instrument.

Any assistance or contributions on the splicing front would be gladly 
accepted.

> I am working on an event based strategy -- the eventIndicators function just
> returns a whole list of events in xts format (values = 1) that coincide with
> the index datetimes of the mktdata
>
> # add the event indicators
> stratEvent<- add.indicator(strategy = stratEvent, name = "eventIndicators",
> arguments = list(price = quote(getPrice(mktdata))))
>
> I then add rules for entry and exit based on the event column being true:
>
> stratEvent<- add.rule(stratEvent, name='ruleSignal', arguments =
> list(sigcol="MEm1"),sigval=TRUE, orderqty=100, ordertype= 'market',
> orderside=NULL, threshold=NULL),type='enter')
>
> I would like to have this strategy applied to a futures contract based on a
> specified rolling convention (e.g. if<  2 days before first notice of
> delivery, trade the 2nd contract, otherwise trade the 1st e.g. TY2 Comdty
> versus TY1 Comdty).
>
> I would like to apply this strategy to 1 portfolio covering multiple decades
> of data of closing price data with the whole futures chain.  I'm not sure
> how to call applyStrategy to get the result I want when the instrument the
> strategy is trading changes over time.

I would construct a continuous series first, then add an instrument for 
that continuous series to your portfolio, and test your strategy using 
the continuous series information.

Regards,

   - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list