Let's say today is September 2, 2013. The most liquid ES contract would be
the September 2013 contract. However, from September 12, 2013, the most
liquid ES contract would be the December 2013 contract. See the comments
in MostLiquidContract class for the explanation.

The above is relevant for the ES, YM, and some other CME contracts which
have a quarterly expiration, but the rules are totally different for other
futures contracts.

So, to make it work for all contracts, instead of using
getMostLiquidContract(ES, 4, 3, 3), which implies the knowledge of the
expiration cycle, I would use this:
getMostLiquidContract(ticker).

This method should always request four different contracts starting from
the current month, and the three months going forward. For example, if
today is December 10, 2013, the following four contracts should be
requested:

December 2013
January 2014
February 2014
March 2014

This would cover all the cases with the contracts on the quarterly
expiration schedules (such as the ES) and the monthly expiration schedules
(such as the CL). In case of the ES, the January 2014 and the February 2014
contracts do not exist, so the resulting errors can be ignored. This would
also work for grains (such as ZC and ZW). Alexander, please confirm.






On Sat, Aug 24, 2013 at 9:27 AM, Mick O'Donnell <[email protected]>wrote:

> Thanks for that Eugene,
>
> I had a chat with Vincent there, who is working with me on this. We just
> discussed the logic for comparing the next two contracts. Here's an example:
>
> - JBT needs to know the correct contract for ES.
> - It calls a new method getMostLiquidContract(ES, 4, 3, 3), where:
>
>    - 1st parameter indicates the symbol,
>    - the 2nd is the number of contracts in a year (4),
>    - and the 3rd is the first contract in a calendar year (3 (or March)).
>
> - From there we can get the next two contracts: Sept and Dec, and it's
> abstract enough to use for all symbols.
> - Once we're in Sept, it would start comparing the Dec and Mar (next year).
>
> We'd never be trading a Sept contract in Sept right? It'll always have
> expired by then. Let us know what you think. Hoping to have the code ready
> for next week.
>
> regards,
>
> Michael.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "JBookTrader" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/jbooktrader.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"JBookTrader" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jbooktrader.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to