Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Option Symbols Incorrect Across Splits

Open isobretatel opened this issue 8 years ago • 6 comments

Trading AAPL options:

2014-06-09 00:00:00 : | Runtime Error: System.ArgumentNullException: Value cannot be null. Parameter name: key at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].ContainsKey (TKey key) [0x0000b] in :0 at QuantConnect.Securities.SecurityManager.get_Item (QuantConnect.Symbol symbol) [0x00001] in <88b912b0fd84484faf8b4c982c08e712>:0 at QuantConnect.Securities.SecurityPortfolioManager.ApplySplitToOptions (QuantConnect.Data.Market.Split split) [0x000a3] in <88b912b0fd84484faf8b4c982c08e712>:0 at QuantConnect.Securities.SecurityPortfolioManager.ApplySplit (QuantConnect.Data.Market.Split split) [0x00009] in <88b912b0fd84484faf8b4c982c08e712>:0 at QuantConnect.Lean.Engine.AlgorithmManager.Run (QuantConnect.Packets.AlgorithmNodePacket job, QuantConnect.Interfaces.IAlgorithm algorithm, QuantConnect.Lean.Engine.DataFeeds.IDataFeed feed, QuantConnect.Lean.Engine.TransactionHandlers.ITransactionHandler transactions, QuantConnect.Lean.Engine.Results.IResultHandler results, QuantConnect.Lean.Engine.RealTime.IRealTimeHandler realtime, QuantConnect.Lean.Engine.Server.ILeanManager leanManager, QuantConnect.Lean.Engine.Alpha.IAlphaHandler alphas, System.Threading.CancellationToken token) [0x00bd9] in <2516aeb381a54c2a9787b534047df995>:0

isobretatel avatar Dec 31 '17 15:12 isobretatel

Hi @isobretatel; please provide an example algorithm which caused this error; and the data you used to cause it. LEAN does handle option splits but there may be some oddity with your setup. Thanks

jaredbroad avatar Dec 31 '17 17:12 jaredbroad

@jaredbroad Here's a simple one

dillonricketts avatar Jan 09 '18 03:01 dillonricketts

Thank you @dillonricketts. I verified the bug and assigned to @StefanoRaggi, since he knows that code well.

AlexCatarino avatar Jan 09 '18 18:01 AlexCatarino

This is a quite tricky one. Actually the symbol objects won't work for options and we'll need to do a refactor of Symbol objects to handle this.. we're still brain storming the best solution but will circle back shortly.

jaredbroad avatar Jan 12 '18 18:01 jaredbroad

Just an update here - this is a complex issue and we've had to do a work around for now so at least the backtest modelling / equity curves will be accurate (https://github.com/QuantConnect/Lean/pull/1503).

Long term we may need another data-source to know how the option-symbols are mapped. There is no reliable pattern from the OTCC.

Leaving issue open until we crack the mapping post-split/renames and solve properly.

jaredbroad avatar Feb 01 '18 00:02 jaredbroad

Closing as we now close option positions on a split warning.

jaredbroad avatar Feb 17 '23 23:02 jaredbroad