-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add 1-Ounce Gold and Micro Ultra Treasury futures #9692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,24 @@ public static Func<DateTime, DateTime> FuturesExpiryFunction(Symbol symbol) | |
| return FuturesExpiryUtilityFunctions.NthLastBusinessDay(time,3, holidays); | ||
| }) | ||
| }, | ||
| // 1-Ounce Gold (1OZ): https://www.cmegroup.com/markets/metals/precious/1-ounce-gold.contractSpecs.html | ||
| {Symbol.Create(Futures.Metals.OneOunceGold, SecurityType.Future, Market.COMEX), (time => | ||
| { | ||
| var market = Market.COMEX; | ||
| var symbol = Futures.Metals.OneOunceGold; | ||
| var holidays = FuturesExpiryUtilityFunctions.GetExpirationHolidays(market, symbol); | ||
| // Bi-monthly contracts (Feb/2, Apr/4, Jun/6, Aug/8, Oct/10, Dec/12 cycle) | ||
| while (!FutureExpirationCycles.GJMQVZ.Contains(time.Month)) | ||
| { | ||
| time = time.AddMonths(1); | ||
| } | ||
|
|
||
| // This contract is cash settled, so it stops trading before the contract month even starts. | ||
| // Trading terminates on the third last business day of the month prior to the contract month. | ||
| var previousMonth = time.AddMonths(-1); | ||
| return FuturesExpiryUtilityFunctions.NthLastBusinessDay(previousMonth, 3, holidays); | ||
| }) | ||
| }, | ||
| // Silver (SI): http://www.cmegroup.com/trading/metals/precious/silver_contract_specifications.html | ||
| {Symbol.Create(Futures.Metals.Silver, SecurityType.Future, Market.COMEX), (time => | ||
| { | ||
|
|
@@ -1674,6 +1692,48 @@ public static Func<DateTime, DateTime> FuturesExpiryFunction(Symbol symbol) | |
| return FuturesExpiryUtilityFunctions.NthLastBusinessDay(time, 8, holidays); | ||
| }) | ||
| }, | ||
| // Micro Ultra 10-Year U.S. Treasury Note (MTN): https://www.cmegroup.com/markets/interest-rates/us-treasury/micro-ultra-10-year-us-treasury-note.contractSpecs.html | ||
| {Symbol.Create(Futures.Financials.MicroUltraTenYearUSTreasuryNote, SecurityType.Future, Market.CBOT), (time => | ||
| { | ||
| var market = Market.CBOT; | ||
| var symbol = Futures.Financials.MicroUltraTenYearUSTreasuryNote; | ||
| var holidays = FuturesExpiryUtilityFunctions.GetExpirationHolidays(market, symbol); | ||
|
|
||
| // Quarterly contracts (Mar, Jun, Sep, Dec), the same cycle as the Ultra 10-Year (TN) | ||
| while (!FutureExpirationCycles.HMUZ.Contains(time.Month)) | ||
| { | ||
| time = time.AddMonths(1); | ||
| } | ||
|
|
||
| // This contract is cash settled against TN instead of delivering notes, so it stops | ||
| // trading earlier than TN does. | ||
| // Trading terminates at 2:00 p.m. CT 2 business days before the first delivery day | ||
| // of the contract month. The first delivery day is the first business day of that month. | ||
| var firstDeliveryDay = FuturesExpiryUtilityFunctions.NthBusinessDay(time, 1, holidays); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the 1OZ note: this lands in the previous month, so { Futures.Financials.MicroUltraTenYearUSTreasuryNote, 1 }, |
||
| return FuturesExpiryUtilityFunctions.AddBusinessDays(firstDeliveryDay, -2, holidays).AddHours(19); | ||
| }) | ||
| }, | ||
| // Micro Ultra U.S. Treasury Bond (MWN): https://www.cmegroup.com/markets/interest-rates/us-treasury/micro-ultra-us-treasury-bond.contractSpecs.html | ||
| {Symbol.Create(Futures.Financials.MicroUltraUSTreasuryBond, SecurityType.Future, Market.CBOT), (time => | ||
| { | ||
| var market = Market.CBOT; | ||
| var symbol = Futures.Financials.MicroUltraUSTreasuryBond; | ||
| var holidays = FuturesExpiryUtilityFunctions.GetExpirationHolidays(market, symbol); | ||
|
|
||
| // Quarterly contracts (Mar, Jun, Sep, Dec), the same cycle as the Ultra Bond (UB) | ||
| while (!FutureExpirationCycles.HMUZ.Contains(time.Month)) | ||
| { | ||
| time = time.AddMonths(1); | ||
| } | ||
|
|
||
| // This contract is cash settled against UB instead of delivering bonds, so it stops | ||
| // trading earlier than UB does. | ||
| // Trading terminates at 2:00 p.m. CT 2 business days before the first delivery day | ||
| // of the contract month. The first delivery day is the first business day of that month. | ||
| var firstDeliveryDay = FuturesExpiryUtilityFunctions.NthBusinessDay(time, 1, holidays); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
{ Futures.Financials.MicroUltraUSTreasuryBond, 1 }, |
||
| return FuturesExpiryUtilityFunctions.AddBusinessDays(firstDeliveryDay, -2, holidays).AddHours(19); | ||
| }) | ||
| }, | ||
| // Energy group | ||
| // Propane Non LDH Mont Belvieu (1S): https://www.cmegroup.com/trading/energy/petrochemicals/propane-non-ldh-mt-belvieu-opis-balmo-swap_contract_specifications.html | ||
| {Symbol.Create(Futures.Energy.PropaneNonLDHMontBelvieu, SecurityType.Future, Market.NYMEX), (time => | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # we don't have historical information for this symbol | ||
| # CME CBOT outright maintenance margin, 09/2026-12/2026; initial = 110% of maintenance | ||
| date,initial,maintenance | ||
| 19900101,281,255 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # we don't have historical information for this symbol | ||
| # CME CBOT outright maintenance margin, 09/2026-12/2026; initial = 110% of maintenance | ||
| date,initial,maintenance | ||
| 19900101,567,515 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # we don't have historical information for this symbol | ||
| # CME COMEX outright maintenance margin, 10/2026 front month; initial = 110% of maintenance | ||
| date,initial,maintenance | ||
| 19900101,242,220 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this returns a date in the month before the contract month,
1OZalso needs registering inFuturesExpiryUtilityFunctions.ExpiriesPriorMonth— that's the companion half of theHHpattern you followed (HHis there at line 414).Without it,
SymbolRepresentation.GenerateFutureTickerrenders the Feb-2026 contract as1OZ28F26instead of1OZ28G26(I confirmed this by test), andLeanDatapaths plusFutureUniverse.ToCsvrecord the wrong contract month. Add to that dictionary:Worth a
[TestCase]inSymbolRepresentationTests.GenerateFutureTickerExpiringInPreviousMonthalongside the existingCL/HHrows.