Skip to content

Commit

Permalink
Use Futures Bank Holidays For Expirations
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Molinero committed Feb 7, 2025
1 parent 9be02d7 commit cb62493
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public override void OnEndOfAlgorithm()
/// <summary>
/// Data Points count of all timeslices of algorithm
/// </summary>
public virtual long DataPoints => 4632655;
public virtual long DataPoints => 4632654;

/// <summary>
/// Data Points count of the algorithm history
Expand Down
11 changes: 1 addition & 10 deletions Common/Securities/Future/FuturesExpiryUtilityFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ public static class FuturesExpiryUtilityFunctions
"GNF"
};

/// <summary>
/// True to account for bank holidays which will adjust futures expiration dates
/// </summary>
public static bool BankHolidays { get; set; }

/// <summary>
/// Get holiday list from the MHDB given the market and the symbol of the security
/// </summary>
Expand All @@ -53,11 +48,7 @@ internal static HashSet<DateTime> GetExpirationHolidays(string market, string sy
var exchangeHours = MarketHoursDatabase.FromDataFolder()
.GetEntry(market, symbol, SecurityType.Future)
.ExchangeHours;
if (BankHolidays)
{
return exchangeHours.Holidays.Concat(exchangeHours.BankHolidays).ToHashSet();
}
return exchangeHours.Holidays;
return exchangeHours.Holidays.Concat(exchangeHours.BankHolidays).ToHashSet();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public class FuturesExpiryFunctionsTests
[OneTimeSetUp]
public void Init()
{
FuturesExpiryUtilityFunctions.BankHolidays = true;
var path = Path.Combine("TestData", "FuturesExpiryFunctionsTestData.xml");
using (var reader = XmlReader.Create(path))
{
Expand All @@ -70,12 +69,6 @@ public void Init()
}
}

[OneTimeTearDown]
public void TearDown()
{
FuturesExpiryUtilityFunctions.BankHolidays = false;
}

// last day and previous are holidays
[TestCase("20250101", "20250127")]
// normal case
Expand Down

0 comments on commit cb62493

Please sign in to comment.