Skip to content
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

Use Futures Bank Holidays For Expirations #8580

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading