Function imm_code_to_dates
pub fn imm_code_to_dates(
code: &str,
cycle: ImmCycle,
) -> Result<(NaiveDate, NaiveDate), ImmCodeError>Expand description
Resolves an IMM code (three-letter month + two-digit year, e.g. "JUN27")
to its unadjusted (start, end) reference-period dates: the period of the
futures contract the code names, as a
FutureTemplate’s reference
period read it.
start is the third Wednesday of the named month-year; end is the third
Wednesday of the next IMM in cycle (3 months later for ImmCycle::Imm3M,
1 month later for ImmCycle::Imm1M). Years resolve in the 2000–2099
window. A CME month letter and year ("H22") names the same month as
"MAR22". A quarterly code naming a non-cycle month (e.g. "JAN27"), or
any code outside the MMM + YY and letter + YY shapes, is rejected.
§Errors
ImmCodeError carrying code when it is not five bytes, does not split
cleanly into a three-letter month and a two-digit year, names no month in
the table, or — under ImmCycle::Imm3M — names a month outside the
quarterly cycle.