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

Add BTIC on cryptocurrencies futures back #8503

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions Common/Orders/Fees/InteractiveBrokersFeeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ private static CashAmount EUREXFutureFees(Security security)
{ "MYM", 0.25m }, { "M2K", 0.25m }, { "MES", 0.25m }, { "MNQ", 0.25m }, { "2YY", 0.25m }, { "5YY", 0.25m }, { "10Y", 0.25m },
{ "30Y", 0.25m }, { "MCL", 0.25m }, { "MGC", 0.25m }, { "SIL", 0.25m },
// Cryptocurrency Futures
{ "BTC", 5m }, { "MBT", 2.25m }, { "ETH", 3m }, { "MET", 0.20m },
{ "BTC", 5m }, { "MBT", 2.25m }, { "ETH", 3m }, { "MET", 0.20m }, { "MIB", 2.25m }, { "MRB", 0.20m },
// E-mini FX (currencies) Futures
{ "E7", 0.50m }, { "J7", 0.50m },
// Micro E-mini FX (currencies) Futures
Expand All @@ -441,7 +441,7 @@ private static CashAmount EUREXFutureFees(Security security)
{ "MYM", 0.25m }, { "M2K", 0.25m }, { "MES", 0.25m }, { "MNQ", 0.25m }, { "2YY", 0.25m }, { "5YY", 0.25m }, { "10Y", 0.25m },
{ "30Y", 0.25m }, { "MCL", 0.25m }, { "MGC", 0.25m }, { "SIL", 0.25m },
// Cryptocurrency Future Options
{ "BTC", 5m }, { "MBT", 1.25m }, { "ETH", 3m }, { "MET", 0.10m },
{ "BTC", 5m }, { "MBT", 1.25m }, { "ETH", 3m }, { "MET", 0.10m }, { "MIB", 1.25m }, { "MRB", 0.10m }
};

private static readonly Dictionary<string, decimal> _usaFuturesExchangeFees = new()
Expand All @@ -452,7 +452,7 @@ private static CashAmount EUREXFutureFees(Security security)
{ "MYM", 0.30m }, { "M2K", 0.30m }, { "MES", 0.30m }, { "MNQ", 0.30m }, { "2YY", 0.30m }, { "5YY", 0.30m }, { "10Y", 0.30m },
{ "30Y", 0.30m }, { "MCL", 0.30m }, { "MGC", 0.30m }, { "SIL", 0.30m },
// Cryptocurrency Futures
{ "BTC", 6m }, { "MBT", 2.5m }, { "ETH", 4m }, { "MET", 0.20m },
{ "BTC", 6m }, { "MBT", 2.5m }, { "ETH", 4m }, { "MET", 0.20m }, { "MIB", 2.5m }, { "MRB", 0.20m },
// E-mini FX (currencies) Futures
{ "E7", 0.85m }, { "J7", 0.85m },
// Micro E-mini FX (currencies) Futures
Expand All @@ -474,7 +474,7 @@ private static CashAmount EUREXFutureFees(Security security)
{ "MYM", 0.20m }, { "M2K", 0.20m }, { "MES", 0.20m }, { "MNQ", 0.20m }, { "2YY", 0.20m }, { "5YY", 0.20m }, { "10Y", 0.20m },
{ "30Y", 0.20m }, { "MCL", 0.20m }, { "MGC", 0.20m }, { "SIL", 0.20m },
// Cryptocurrency Future Options
{ "BTC", 5m }, { "MBT", 2.5m }, { "ETH", 4m }, { "MET", 0.20m },
{ "BTC", 5m }, { "MBT", 2.5m }, { "ETH", 4m }, { "MET", 0.20m }, { "MIB", 2.5m }, { "MRB", 0.20m },
};

/// <summary>
Expand Down
12 changes: 12 additions & 0 deletions Common/Securities/Future/Futures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,18 @@ public static class Currencies
/// </summary>
/// <returns>The symbol</returns>
public const string MicroBTC = "MBT";

/// <summary>
/// BTIC on Micro Ether Futures
/// </summary>
/// <returns>The symbol</returns>
public const string BTICMicroEther = "MRB";

/// <summary>
/// BTIC on Micro Bitcoin Futures
/// </summary>
/// <returns>The symbol</returns>
public const string BTICMicroBTC = "MIB";
}

/// <summary>
Expand Down
57 changes: 57 additions & 0 deletions Common/Securities/Future/FuturesExpiryFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3698,6 +3698,63 @@ Dec listed in June

return lastFriday.Add(new TimeSpan(15, 0, 0));
})
},
// BTIC on Micro Ether Futures (MRB): https://www.cmegroup.com/markets/cryptocurrencies/ether/micro-ether.contractSpecs.html
{Symbol.Create(Futures.Currencies.BTICMicroEther, SecurityType.Future, Market.CME), (time =>
{
// Monthly contracts listed for 6 consecutive months and 2 additional Dec contract months.

// Trading terminates at 4:00 p.m. London time on the last Friday of the contract month.
// If this is not both a London and U.S. business day, trading terminates on the prior
// London and the U.S. business day.

// BTIC: Trading terminates at 4:00 p.m. London time on the last Thursday of the contract
// month.If this is not both a London and U.S. business day, trading terminates on the prior
// London and the U.S. business day.

var lastThursday = FuturesExpiryUtilityFunctions.LastThursday(time);

var holidays = MarketHoursDatabase.FromDataFolder()
.GetEntry(Market.CME, Futures.Currencies.BTICMicroEther, SecurityType.Future)
.ExchangeHours
.Holidays;

while (holidays.Contains(lastThursday))
{
lastThursday = FuturesExpiryUtilityFunctions.AddBusinessDays(lastThursday, -1, holidays);
}

return lastThursday.Add(new TimeSpan(15, 0, 0));
})
},
// BTIC on Micro Bitcoin Futures (MIB): https://www.cmegroup.com/markets/cryptocurrencies/bitcoin/micro-bitcoin.contractSpecs.html
{Symbol.Create(Futures.Currencies.BTICMicroBTC, SecurityType.Future, Market.CME), (time =>
{
// Monthly contracts listed for 6 consecutive months and 2 additional Dec contract months.
// If the 6 consecutive months includes Dec, list only 1 additional Dec contract month.

// Trading terminates at 4:00 p.m. London time on the last Friday of the contract month.
// If this is not both a London and U.S. business day, trading terminates on the prior
// London and the U.S. business day.

// BTIC: Trading terminates at 4:00 p.m. London time on the last Thursday of the contract
// month.If this is not both a London and U.S. business day, trading terminates on the prior
// London and the U.S. business day.

var lastThursday = FuturesExpiryUtilityFunctions.LastThursday(time);

var holidays = MarketHoursDatabase.FromDataFolder()
.GetEntry(Market.CME, Futures.Currencies.BTICMicroBTC, SecurityType.Future)
.ExchangeHours
.Holidays;

while (holidays.Contains(lastThursday))
{
lastThursday = FuturesExpiryUtilityFunctions.AddBusinessDays(lastThursday, -1, holidays);
}

return lastThursday.Add(new TimeSpan(15, 0, 0));
})
}
};
}
Expand Down
Loading
Loading