Skip to main content

og_monthly_expiry

Function og_monthly_expiry 

Source
fn og_monthly_expiry(
    option_year: i32,
    option_month: u32,
) -> Option<DateTime<Utc>>
Expand description

Compute the nominal expiry for a CME OG (gold-on-futures) monthly option contract in the requested option-contract month.

CME rule: “Trading terminates at 1:30 p.m. CT on the 4th last business day of the month prior to the option contract month.” This function implements the “4th last business day of the prior month” piece at daily resolution and returns UTC midnight of that day.

§Limitations

The US-holiday calendar is not applied here — we treat Mon–Fri as business days regardless of federal holidays. Near-end-of-month holidays (e.g. Memorial Day on the last Monday of May) can shift the real CME expiry by one calendar day vs. what this function returns. For the nearest Jan–Dec 2026 months none of the federal holidays fall inside the “last 4 business days” window, so the approximation is correct for our current deployment surface; the cycle-4 unit tests pin the specific months we’ve verified by hand. Production-grade holiday handling is a v2 item.