Oil Expiration Dates

An easy, though manual process, is to perform a lookup of the last trading day calendar every year and put that into the database. For Oil, so far the best resource I've found is at http://www.cmegroup.com/

  1. Select Energy
    Go the the homepage and select the energy section.
    oil-select-energy

  2. Select Oil
    Once in the energy section, select oil.
    oil-select-oil

  3. Select Product Calendar
    Once in oil, select the 'product calendar' section of oil.
    oil-select-productcalendar

  4. View Last Trading Dates
    Now you should be able to see a table of Last Trading Days. Use this table to create some SQL insert statements to put into the FUTURES_EXPIRATIONS database table. For example, given this information:
    Contract Month: JAN 2012
    Last Trade Day: 12/20/2011
    The SQL would look like:
    INSERT INTO
      futures_expirations
      ( id, created_on, updated_on, ticker_symbol, contract_description ,contract_month ,contract_year ,last_trading_day )
    VALUES
      (
    'b360c358-1cb6-408a-81f1-c466dfb7344c' -- A unique identifer
    , now() -- Timestamp row was created
    , now() -- Timestamp row was updated
    , 'cl' -- The base ticker symbol for the future, in this case cl is for oil
    , 'crude oil for 2012 jan' -- A description of the contract
    , 'f' -- The letter indicating what month this contract is trading for.
    , 12 -- The year this contract is trading for.
    , to_date('12/20/2011','MM/DD/YYYY') -- When is the last day of trading for this contract
    );

    oil-select-lasttradeday