Skip to content

Commit

Permalink
fix: skip subscribe on Expired Option Symbol (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
Romazes authored Aug 19, 2024
1 parent 5cf6e91 commit f339040
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3634,6 +3634,13 @@ private bool Subscribe(IEnumerable<Symbol> symbols)
continue;
}

// Skip subscribing to expired option contracts
if (OptionSymbol.IsOptionContractExpired(symbol, DateTime.UtcNow))
{
Log.Trace($"InteractiveBrokersBrokerage.Subscribe(): Skipping subscription for {symbol} because the contract has expired.");
continue;
}

var id = GetNextId();
var contract = CreateContract(subscribeSymbol, includeExpired: false);
var symbolProperties = _symbolPropertiesDatabase.GetSymbolProperties(subscribeSymbol.ID.Market, subscribeSymbol, subscribeSymbol.SecurityType, Currencies.USD);
Expand Down

0 comments on commit f339040

Please sign in to comment.