@@ -303,26 +303,39 @@ def test_fmelli_instant():
303
303
304
304
@patch_get_content ('MarketWatchInit.aspx' )
305
305
def test_market_watch_init ():
306
- df = market_watch_init ()['prices' ]
307
- assert df .dtypes .to_dict () == {
306
+ dtypes = {
308
307
'heven' : 'int64' , 'pf' : 'int64' , 'pc' : 'int64'
309
308
, 'pl' : 'int64' , 'tno' : 'int64' , 'tvol' : 'int64'
310
309
, 'tval' : 'int64' , 'pmin' : 'int64' , 'pmax' : 'int64'
311
310
, 'py' : 'int64' , 'eps' : 'float64' , 'bvol' : 'int64'
312
311
, 'visitcount' : 'int64' , 'flow' : 'int64'
313
312
, 'cs' : 'int64' , 'tmax' : 'float64' , 'tmin' : 'float64'
314
- , 'z' : 'int64' , 'yval' : 'int64' , 'pd1' : 'Int64'
315
- , 'po1' : 'Int64' , 'qd1' : 'Int64' , 'qo1' : 'Int64'
316
- , 'zd1' : 'Int64' , 'zo1' : 'Int64' , 'pd2' : 'Int64'
317
- , 'po2' : 'Int64' , 'qd2' : 'Int64' , 'qo2' : 'Int64'
318
- , 'zd2' : 'Int64' , 'zo2' : 'Int64' , 'pd3' : 'Int64'
319
- , 'po3' : 'Int64' , 'qd3' : 'Int64' , 'qo3' : 'Int64'
320
- , 'zd3' : 'Int64' , 'zo3' : 'Int64' }
321
- index = df .index
322
- assert index .names == ['ins_code' , 'isin' , 'l18' , 'l30' ]
323
- assert index .dtype == 'O'
324
- # in pandas 1.3 there will be no need for `.to_frame()`
325
- assert index .to_frame ().dtypes .to_list () == ['int64' , 'O' , 'O' , 'O' ]
313
+ , 'z' : 'int64' , 'yval' : 'int64' }
314
+
315
+ mwi = market_watch_init (join = False , market_state = False )
316
+ assert mwi ['prices' ].dtypes .to_dict () == dtypes
317
+ assert mwi ['best_limits' ].index .names == ['ins_code' , 'row' ]
318
+ assert 'market_state' not in mwi
319
+
320
+ mwi = market_watch_init (market_state = True )
321
+ prices = mwi ['prices' ]
322
+ assert 'market_state' in mwi
323
+ assert 'best_limits' in mwi
324
+ assert prices .dtypes .to_dict () == {
325
+ ** dtypes , 'pd1' : 'int64'
326
+ , 'po1' : 'int64' , 'qd1' : 'int64' , 'qo1' : 'int64'
327
+ , 'zd1' : 'int64' , 'zo1' : 'int64' , 'pd2' : 'int64'
328
+ , 'po2' : 'int64' , 'qd2' : 'int64' , 'qo2' : 'int64'
329
+ , 'zd2' : 'int64' , 'zo2' : 'int64' , 'pd3' : 'int64'
330
+ , 'po3' : 'int64' , 'qd3' : 'int64' , 'qo3' : 'int64'
331
+ , 'zd3' : 'int64' , 'zo3' : 'int64' }
332
+ assert prices .index .dtypes .to_dict () == {
333
+ 'ins_code' : 'int64' , 'isin' : 'O' , 'l18' : 'O' , 'l30' : 'O' }
334
+
335
+ mwi = market_watch_init (prices = False , market_state = False )
336
+ assert 'prices' not in mwi
337
+ assert mwi ['best_limits' ].index .dtypes .to_dict () == {
338
+ 'ins_code' : 'int64' , 'row' : 'int64' }
326
339
327
340
328
341
@patch_get_content ('ClosingPriceAll.aspx' )
0 commit comments