@@ -97,6 +97,70 @@ public void GetsTickData()
9797 }
9898 }
9999
100+ [ Test ]
101+ public void SubscribeOnFutureMappedSymbols ( )
102+ {
103+ using var cts = new CancellationTokenSource ( ) ;
104+ using var resetEvent = new ManualResetEvent ( false ) ;
105+ using var ib = new InteractiveBrokersBrokerage ( new QCAlgorithm ( ) , new OrderProvider ( ) , new SecurityProvider ( ) ) ;
106+
107+ var mxnFuture = Symbol . CreateFuture ( Futures . Currencies . MXN , Market . CME , new ( 2026 , 03 , 16 ) ) ;
108+ var mxnFutureOptionContract = Symbol . CreateOption ( mxnFuture , mxnFuture . ID . Market , SecurityType . FutureOption . DefaultOptionStyle ( ) , OptionRight . Call , 0.055m , new ( 2026 , 01 , 09 ) ) ;
109+
110+ var symbols = new List < Symbol > ( )
111+ {
112+ mxnFuture ,
113+ mxnFutureOptionContract
114+ } ;
115+
116+ var securityNotFoundCounter = 0 ;
117+ var securityDefinitionsFound = 0 ;
118+ ib . Message += ( _ , brokerageMessageEvent ) =>
119+ {
120+ switch ( brokerageMessageEvent . Code )
121+ {
122+ case "200" :
123+ // Code: 200 - No security definition has been found for the request.
124+ securityNotFoundCounter += 1 ;
125+ break ;
126+ case "354" :
127+ // Requested market data is not subscribed. Delayed market data is available.
128+ securityDefinitionsFound += 1 ;
129+ if ( securityDefinitionsFound >= symbols . Count )
130+ {
131+ resetEvent . Set ( ) ;
132+ }
133+ break ;
134+
135+ }
136+ } ;
137+
138+ ib . Connect ( ) ;
139+
140+ var configs = new List < SubscriptionDataConfig > ( symbols . Count ) ;
141+ foreach ( var symbol in symbols )
142+ {
143+ var config = GetSubscriptionDataConfig < Tick > ( symbol , Resolution . Tick ) ;
144+ ProcessFeed ( ib . Subscribe ( config , ( _ , _ ) => { } ) , cts , ( _ ) => { } ) ;
145+ configs . Add ( config ) ;
146+ }
147+
148+ _ = resetEvent . WaitOne ( TimeSpan . FromSeconds ( 20 ) , cts . Token ) ;
149+
150+ foreach ( var config in configs )
151+ {
152+ ib . Unsubscribe ( config ) ;
153+ }
154+
155+ resetEvent . Reset ( ) ;
156+ resetEvent . WaitOne ( TimeSpan . FromSeconds ( 1 ) , cts . Token ) ;
157+
158+ cts . Cancel ( ) ;
159+
160+ Assert . GreaterOrEqual ( securityDefinitionsFound , symbols . Count ) ;
161+ Assert . AreEqual ( 0 , securityNotFoundCounter ) ;
162+ }
163+
100164 [ Test ]
101165 public void GetsTickDataAfterDisconnectionConnectionCycle ( )
102166 {
0 commit comments