Hi Roscoe,
THE GOOD:
I do have code to build continuous contracts. The basic design is that you provide a set of roll rules (encoded as text like 'roll_on_last_trading_day=-5') and a set of contracts into the algorithm, and it spits out a continuous contract as well as the list of rules that actually caused a specific roll. If you have multiple rules to use when building a specific contract, you can define the precedence of them (i.e. a 'roll_on_volume=.95%' rule can take priority over a 'roll_on_last_trading_day=-5' rule)
You can provide as many rules as you like. In addition, you can explicitly filter out contracts via a simple rule (i.e. 'filter_out_contract=20100700').
The rules are specific to a market, i.e. the roll rules for spus are different than the roll rules for corn.
You can also build different types of continuous contracts, i.e. backward absolute adjusted and forward ratio adjusted by passing a parameter to the code (i.e. 'BAA' for backward absolute adjusted)
The price data input is organized by contract, it can be loaded from either a flat file or a database. Also, there are data adapters to normalize the data from different vendors, i.e. you can build a single continuous contract for bonds using data say 1980-2000 from Tradestation, and 2001-2010 from CSI
THE NOT SO GOODS
This code is implemented in c#, not C++.
The roll rules are implemented as a custom designed, pretty easy to understand RollRule class. So to add additional roll rules, you have to know a bit of C#/object orientated programming. Of course the roll rules as described above (i.e. the 'roll_on_last_trading_day=-5') allow one to put their own parameters in, so instead of rolling on 5 days before the last trading day, you could encode the rule like 'roll_on_last_trading_day=-10'.
I have about 4 roll rules developed so far (i.e. wrote code to parse/enforce 4 different rules). But if you have the skill, you can write 100s of different types of rules.
The code is part of a larger software system I'm working on. So I wouldn't want to distribute the entire system, just the continuous contract subsystem if you will. Not too much a problem to distribute just that however.
If you have any questions, comments etc, please let me know. FWIW I've been pretty much a lurker on this board for a while, never contributed much
. Been working in the managed futures industry for sometime, worked for a bunch of turtles and currently work for a small (70mill AUM) short term CPO/CTA
David