Skip to content

Commit

Permalink
Models All Index Futures Listed in CME (#7722)
Browse files Browse the repository at this point in the history
* Models All Index Futures Listed in CME

We added:
NIY, ENY, FT1, FT5, E3G, FTU, TPD, TPY

* Models All Index Futures Listed in CME

We added international index futures:
NIY, ENY, FT5, FT1, E3G, FTU, TPD and TPY

* Remove unused imports

* Address peer review:
- Corrected serial contract logic
- Corrected minimum price fluctuation
- Corrected “Yen” to “JPY”

Added equity index futures:
RX, ESG, RS1 and SDA
  • Loading branch information
ashutoshrana171 authored Jan 29, 2024
1 parent ec530d8 commit 3f6a907
Show file tree
Hide file tree
Showing 5 changed files with 5,909 additions and 1,811 deletions.
5 changes: 5 additions & 0 deletions Common/Securities/Future/FutureExpirationCycles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public static class FutureExpirationCycles
/// </summary>
public static readonly int[] March = { 3, 6, 9, 12 };

/// <summary>
/// December Cycle: Expirations in December
/// </summary>
public static readonly int[] December = { 12 };

/// <summary>
/// All Year Cycle: Expirations in every month of the year
/// </summary>
Expand Down
73 changes: 73 additions & 0 deletions Common/Securities/Future/Futures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,79 @@ public static class Indices
/// <returns>The symbol</returns>
public const string Nikkei225Dollar = "NKD";

/// <summary>
/// Nikkei-225 Yen denominated Futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string Nikkei225YenCME = "NIY";


// <summary>
/// E-mini Nikkei 225 Yen denominated Futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string Nikkei225YenEMini = "ENY";

// <summary>
/// E-MINI FTSE China 50 Index Futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string FTSEChina50EMini = "FT5";

// <summary>
/// E-mini FTSE 100 Index (GBP) Futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string FTSE100EMini = "FT1";

// <summary>
/// E-MINI S&P EUROPE 350 ESG Index Futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string SPEurop350ESGEMini = "E3G";

// <summary>
/// E-MINI USD Denominated FTSE 100 Index Futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string FTSE100USDEMini = "FTU";

// <summary>
/// USD Denominated Topix Index Futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string TOPIXUSD = "TPD";

// <summary>
/// YEN Denominated Topix Index Futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string TOPIXYEN = "TPY";

// <summary>
/// Dow Jones Real Estate futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string DowJonesRealEstate = "RX";

// <summary>
/// E-mini SP500 ESG futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string SP500EMiniESG = "ESG";

// <summary>
/// E-mini Russell 1000 futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string Russell1000EMini = "RS1";

/// <summary>
/// S&P 500 Annual dividend index futures on CME
/// </summary>
/// <returns>The symbol</returns>
public const string SP500AnnualDividendIndex = "SDA";

/// <summary>
/// Bloomberg Commodity Index Futures
/// </summary>
Expand Down
252 changes: 252 additions & 0 deletions Common/Securities/Future/FuturesExpiryFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,258 @@ public static Func<DateTime, DateTime> FuturesExpiryFunction(Symbol symbol)
return priorBusinessDay.Add(TimeSpan.FromHours(21));
})
},
// Nikkei225YenCME (NIY): https://www.cmegroup.com/markets/equities/international-indices/nikkei-225-yen.contractSpecs.html
{Symbol.Create(Futures.Indices.Nikkei225YenCME, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.Nikkei225YenCME;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
// Quarterly contracts (Mar, Jun, Sep, Dec) listed for 12 quarters, serial contract listed for 3 months, and 3 additional Dec contract months
// Trading terminates at 5:00 p.m. Eastern Time (ET) on Business Day prior to 2nd Friday of the contract month.
var secondFriday = FuturesExpiryUtilityFunctions.SecondFriday(time);
var priorBusinessDay = secondFriday.AddDays(-1);
while (!FuturesExpiryUtilityFunctions.NotHoliday(priorBusinessDay, holidays))
{
priorBusinessDay = priorBusinessDay.AddDays(-1);
}
return priorBusinessDay.Add(TimeSpan.FromHours(21));
})
},
// Nikkei225YenEMini (ENY): https://www.cmegroup.com/markets/equities/international-indices/emini-nikkei-225-yen.contractSpecs.html
{Symbol.Create(Futures.Indices.Nikkei225YenEMini, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.Nikkei225YenEMini;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
// Four months in the March Quarterly Cycle (Mar, Jun, Sep, Dec)
while (!FutureExpirationCycles.HMUZ.Contains(time.Month))
{
time = time.AddMonths(1);
}
// Trading terminates at 5:00 p.m. Eastern Time (ET) on Business Day prior to 2nd Friday of the contract month.
var secondFriday = FuturesExpiryUtilityFunctions.SecondFriday(time);
var priorBusinessDay = secondFriday.AddDays(-1);
while (!FuturesExpiryUtilityFunctions.NotHoliday(priorBusinessDay, holidays))
{
priorBusinessDay = priorBusinessDay.AddDays(-1);
}
return priorBusinessDay.Add(TimeSpan.FromHours(21));
})
},
// FTSEChina50EMini (FT5): https://www.cmegroup.com/markets/equities/international-indices/e-mini-ftse-china-50-index.contractSpecs.html
{Symbol.Create(Futures.Indices.FTSEChina50EMini, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.FTSEChina50EMini;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Contracts listed for the 2 nearest serial and 4 quarterly months.
//Trading terminates on the second to last business day of the contract month at the end of trading on the Hong Kong Exchange Securities Market
var secondLastBusinessDay = FuturesExpiryUtilityFunctions.NthLastBusinessDay(time,2, holidays);
while (!FuturesExpiryUtilityFunctions.NotHoliday(secondLastBusinessDay, holidays))
{
secondLastBusinessDay = secondLastBusinessDay.AddDays(-1);
}
return secondLastBusinessDay.Add(TimeSpan.FromHours(6));
})
},
// FTSE100EMini (FT1): https://www.cmegroup.com/markets/equities/international-indices/e-mini-ftse-100-index.contractSpecs.html
{Symbol.Create(Futures.Indices.FTSE100EMini, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.FTSE100EMini;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Contracts listed for five months in the March Quarterly Cycle (Mar, Jun, Sep, Dec)
while (!FutureExpirationCycles.HMUZ.Contains(time.Month))
{
time = time.AddMonths(1);
}
//Trading terminates on the third Friday of the contract month
var thirdFriday = FuturesExpiryUtilityFunctions.NthFriday(time,3);
while (!FuturesExpiryUtilityFunctions.NotHoliday(thirdFriday, holidays))
{
thirdFriday = thirdFriday.AddDays(-1);
}
return thirdFriday;
})
},
// SPEurop350ESGEMini (E3G): https://www.cmegroup.com/markets/equities/international-indices/e-mini-sp-europe-350-esg-index.contractSpecs.html
{Symbol.Create(Futures.Indices.SPEurop350ESGEMini, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.SPEurop350ESGEMini;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Contracts listed for 5 months in the March Quarterly Cycle (Mar, Jun, Sep, Dec)
while (!FutureExpirationCycles.HMUZ.Contains(time.Month))
{
time = time.AddMonths(1);
}
//Trading terminates on the 3rd Friday of contract delivery month.
var thirdFriday = FuturesExpiryUtilityFunctions.NthFriday(time,3);
while (!FuturesExpiryUtilityFunctions.NotHoliday(thirdFriday, holidays))
{
thirdFriday = thirdFriday.AddDays(-1);
}
return thirdFriday;
})
},
// FTSE100USDEMini (FTU): https://www.cmegroup.com/markets/equities/international-indices/e-mini-sp-europe-350-esg-index.contractSpecs.html
{Symbol.Create(Futures.Indices.FTSE100USDEMini, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.FTSE100USDEMini;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Contracts listed for five months in the March Quarterly Cycle (Mar, Jun, Sep, Dec)
while (!FutureExpirationCycles.HMUZ.Contains(time.Month))
{
time = time.AddMonths(1);
}
//Trading terminates on the third Friday of the contract month.
var thirdFriday = FuturesExpiryUtilityFunctions.NthFriday(time,3);
while (!FuturesExpiryUtilityFunctions.NotHoliday(thirdFriday, holidays))
{
thirdFriday = thirdFriday.AddDays(-1);
}
return thirdFriday;
})
},
// TOPIXUSD (TPD): https://www.cmegroup.com/markets/equities/international-indices/usd-denominated-topix-index.contractSpecs.html
{Symbol.Create(Futures.Indices.TOPIXUSD, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.TOPIXUSD;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Quarterly Contracts listed for (Mar, Jun, Sep, Dec) for 5 months
while (!FutureExpirationCycles.HMUZ.Contains(time.Month))
{
time = time.AddMonths(1);
}
//Trading terminates at 5:00 p.m. ET on the Thursday prior to the second Friday of the contract month.
var secondFriday = FuturesExpiryUtilityFunctions.NthFriday(time,2);
var thursdaypriorsecondFriday = secondFriday.AddDays(-1);
while (!FuturesExpiryUtilityFunctions.NotHoliday(thursdaypriorsecondFriday, holidays))
{
thursdaypriorsecondFriday = thursdaypriorsecondFriday.AddDays(-1);
}
return thursdaypriorsecondFriday.Add(TimeSpan.FromHours(21));
})
},
// TOPIXYEN (TPY): https://www.cmegroup.com/markets/equities/international-indices/usd-denominated-topix-index.contractSpecs.html
{Symbol.Create(Futures.Indices.TOPIXYEN, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.TOPIXYEN;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Quarterly Contracts listed for (Mar, Jun, Sep, Dec) for 5 months
while (!FutureExpirationCycles.HMUZ.Contains(time.Month))
{
time = time.AddMonths(1);
}
//Trading terminates at 5:00 p.m. ET on the Thursday prior to the second Friday of the contract month.
var secondFriday = FuturesExpiryUtilityFunctions.NthFriday(time,2);
var thursdaypriorsecondFriday = secondFriday.AddDays(-1);
while (!FuturesExpiryUtilityFunctions.NotHoliday(thursdaypriorsecondFriday, holidays))
{
thursdaypriorsecondFriday = thursdaypriorsecondFriday.AddDays(-1);
}
return thursdaypriorsecondFriday.Add(TimeSpan.FromHours(21));
})
},
// DowJonesRealEstate (RX): https://www.cmegroup.com/markets/equities/dow-jones/dow-jones-rei.contractSpecs.html
{Symbol.Create(Futures.Indices.DowJonesRealEstate, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.DowJonesRealEstate;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Quarterly contracts (Mar, Jun, Sep, Dec) listed for 4 consecutive quarters
while (!FutureExpirationCycles.HMUZ.Contains(time.Month))
{
time = time.AddMonths(1);
}
//Trading can occur up to 9:30 a.m. ET on the 3rd Friday of the contract month
var thirdFriday = FuturesExpiryUtilityFunctions.NthFriday(time,3);
while (!FuturesExpiryUtilityFunctions.NotHoliday(thirdFriday, holidays))
{
thirdFriday = thirdFriday.AddDays(-1);
}
return thirdFriday.Add(new TimeSpan(13, 30, 0));
})
},
// SP500EMiniESG (ESG): https://www.cmegroup.com/markets/equities/sp/e-mini-sandp-500-esg-index.contractSpecs.html
{Symbol.Create(Futures.Indices.SP500EMiniESG, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.SP500EMiniESG;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Quarterly contracts (Mar, Jun, Sep, Dec) listed for 5 consecutive quarters
while (!FutureExpirationCycles.HMUZ.Contains(time.Month))
{
time = time.AddMonths(1);
}
//Trading terminates at 9:30 a.m. ET on the 3rd Friday of the contract month.
var thirdFriday = FuturesExpiryUtilityFunctions.NthFriday(time,3);
while (!FuturesExpiryUtilityFunctions.NotHoliday(thirdFriday, holidays))
{
thirdFriday = thirdFriday.AddDays(-1);
}
return thirdFriday.Add(new TimeSpan(13, 30, 0));
})
},
// Russell1000EMini (RS1): https://www.cmegroup.com/markets/equities/russell/e-mini-russell-1000-index.contractSpecs.html
{Symbol.Create(Futures.Indices.Russell1000EMini, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.Russell1000EMini;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Quarterly contracts (Mar, Jun, Sep, Dec) lisrted for 5 consecutive quarters
while (!FutureExpirationCycles.HMUZ.Contains(time.Month))
{
time = time.AddMonths(1);
}
//Trading terminates at 9:30 a.m. ET on the 3rd Friday of the contract month.
var thirdFriday = FuturesExpiryUtilityFunctions.NthFriday(time,3);
while (!FuturesExpiryUtilityFunctions.NotHoliday(thirdFriday, holidays))
{
thirdFriday = thirdFriday.AddDays(-1);
}
return thirdFriday.Add(new TimeSpan(13, 30, 0));
})
},
// SP500AnnualDividendIndex (SDA): https://www.cmegroup.com/markets/equities/sp/sp-500-annual-dividend-index.contractSpecs.html
{Symbol.Create(Futures.Indices.SP500AnnualDividendIndex, SecurityType.Future, Market.CME), (time =>
{
var market = Market.CME;
var symbol = Futures.Indices.SP500AnnualDividendIndex;
var holidays = FuturesExpiryUtilityFunctions.GetHolidays(market, symbol);
//Annual contracts (December) listed for 11 consecutive years
while (!FutureExpirationCycles.December.Contains(time.Month))
{
time = time.AddMonths(1);
}
//Trading terminates at 9:30 a.m. ET on the 3rd Friday of the contract month.
var thirdFriday = FuturesExpiryUtilityFunctions.NthFriday(time,3);
while (!FuturesExpiryUtilityFunctions.NotHoliday(thirdFriday, holidays))
{
thirdFriday = thirdFriday.AddDays(-1);
}
return thirdFriday.Add(new TimeSpan(13, 30, 0));
})
},
// CBOE Volatility Index Futures (VIX): https://www.cboe.com/tradable_products/vix/vix_futures/specifications/
{Symbol.Create(Futures.Indices.VIX, SecurityType.Future, Market.CFE), (time =>
{
Expand Down
Loading

0 comments on commit 3f6a907

Please sign in to comment.