@@ -237,7 +237,7 @@ def reqMktData(self, contract, *_args):
237237 key = (self .market_data_type , contract .symbol )
238238 attempt = self .market_data_attempts .get (key , 0 )
239239 self .market_data_attempts [key ] = attempt + 1
240- if self .market_data_type == 1 and attempt == 0 :
240+ if self .market_data_type == 3 and attempt == 0 :
241241 return FakeTicker (- 1.0 , close = float ("nan" ), bid = None , ask = None )
242242 return FakeTicker (101.8 , close = 101.8 , bid = 101.7 , ask = 101.9 )
243243
@@ -252,7 +252,8 @@ def reqMktData(self, contract, *_args):
252252 )
253253
254254 self .assertEqual (snapshots ["SPY" ].last_price , 101.8 )
255- self .assertEqual (ib .market_data_attempts [(1 , "SPY" )], 2 )
255+ self .assertEqual (ib .market_data_attempts [(3 , "SPY" )], 2 )
256+ self .assertEqual (ib .market_data_type_calls , [3 , 1 ])
256257 self .assertNotIn (2 , ib .market_data_type_calls )
257258 self .assertNotIn (4 , ib .market_data_type_calls )
258259
@@ -269,9 +270,9 @@ def reqMarketDataType(self, market_data_type):
269270
270271 def reqMktData (self , contract , * _args ):
271272 self .last_market_data_contract = contract
272- if self .market_data_type == 1 :
273+ if self .market_data_type == 3 :
273274 return FakeTicker (- 1.0 , close = float ("nan" ), bid = None , ask = None )
274- if self .market_data_type == 2 :
275+ if self .market_data_type == 4 :
275276 return FakeTicker (- 1.0 , close = float ("nan" ), bid = None , ask = None )
276277 return FakeTicker (- 1.0 , close = 101.8 , bid = None , ask = None )
277278
@@ -284,7 +285,7 @@ def reqMktData(self, contract, *_args):
284285 )
285286
286287 self .assertEqual (snapshots ["SPY" ].last_price , 101.8 )
287- self .assertEqual (ib .market_data_type_calls , [1 , 2 , 4 , 1 ])
288+ self .assertEqual (ib .market_data_type_calls , [3 , 4 , 1 , 1 ])
288289
289290
290291if __name__ == "__main__" :
0 commit comments