Eugene,
I read that Expiration day is 3rd business days following the same rules,
so my code correctly calculates the expire day so far. Wow, 1-day prior to
expiration is rollover, that cuts it close. This means we should set the
volume crossover value to 1 for VOLUME_CROSSOVER_BEFORE_EXP = 1.
I did this, and the code crossed it over 1-day off, due to a
timezone/comparison bug. So, I made a minor fix and added a unit test to
cover your request above, making sure that Janurary 21st trades the March
Contract (which expires on Feb 20th).
You can pull to get the changes and fix.
>From the unit tests ----------- You can see that Jan 21st grabst he 201303
security now, which is the next months contract, and if the 20th was a
trading day it would use the 201302 contract, which expires on Jan 22nd.
volXDay.set(2013, Calendar.JANUARY, 21, 10,0,0);
janVolXover = CLNYMEXMostLiquid.getMostLiquidExpiry(volXDay); //
actually this is called the Feb delivery future, exprires in Jan though
assertEquals("201303", janVolXover); // this would fetch the
March contract, which expires Feb 20th
volXDay.set(2013, Calendar.JANUARY, 20, 10, 0, 0);
String notXoverYet = CLNYMEXMostLiquid.getMostLiquidExpiry(volXDay);
assertEquals("201302", notXoverYet);
On Sat, Jan 12, 2013 at 7:19 PM, Eugene Kononov <[email protected]>wrote:
>
> It has one setting that is important, the VOLUME_CROSSOVER_BEFORE_EXP.
>> This controls when the system will switch to the next months contract.
>> Currently, for my test, this is set to 8 business days. I think this might
>> be slightly too early to switch over, I'll need to collect some data before
>> I'll know for sure.
>>
>>
> Marcus, I did some digging, and came up with this:
>
> "Rollover will be the morning of the 4th business day prior to the 25th
> calendar day of the month preceding the delivery month. If the 25th
> calendar day of the month is a non-business day, the rollover will be the
> morning of the 4th business day prior to the business day preceding the
> 25th calendar day"
>
> As I am planning to add CL to my portfolio, it would be good to know
> definitively the "volume rollover" rules. This month, according to the rule
> above, the volume rollover is Monday, January 21, so I'll watch it for
> confirmation.
>
>
--
You received this message because you are subscribed to the Google Groups
"JBookTrader" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jbooktrader?hl=en.