@@ -460,7 +460,7 @@ async def test_live_subscribe(
460460 mock_live_server : MockLiveServerInterface ,
461461 schema : Schema ,
462462 stype_in : SType ,
463- symbols : str ,
463+ symbols : str | None ,
464464 start : str ,
465465) -> None :
466466 """
@@ -635,6 +635,35 @@ def cb_sub(_: DBNRecord) -> None:
635635 assert second_sub .symbols == "TEST1"
636636
637637
638+ async def test_live_subscribe_different_dataset (
639+ live_client : client .Live ,
640+ mock_live_server : MockLiveServerInterface ,
641+ ) -> None :
642+ """
643+ Test that once a Live client is disconnected, it can be used with a
644+ different subscription dataset.
645+ """
646+ # Arrange
647+ live_client .subscribe (
648+ dataset = Dataset .GLBX_MDP3 ,
649+ schema = Schema .MBO ,
650+ )
651+
652+ # Act
653+ _ = await mock_live_server .wait_for_message_of_type (
654+ message_type = gateway .SubscriptionRequest ,
655+ )
656+
657+ live_client .start ()
658+ await live_client .wait_for_close ()
659+
660+ # Assert
661+ live_client .subscribe (
662+ dataset = Dataset .XNAS_ITCH ,
663+ schema = Schema .MBO ,
664+ )
665+
666+
638667@pytest .mark .usefixtures ("mock_live_server" )
639668def test_live_stop (
640669 live_client : client .Live ,
@@ -1487,18 +1516,17 @@ async def test_live_stream_with_reconnect(
14871516
14881517 """
14891518 # Arrange
1490- if schema == "ohlcv-eod" :
1491- pytest .skip ("no stub data for ohlcv-eod schema" )
1492- if schema == "imbalance" :
1493- pytest .skip ("imbalance is not supported for GLBX.MDP3" )
1494- if schema == "cbbo" :
1495- pytest .skip ("no stub data for cbbo schema" )
1496- if schema == "cbbo-1s" :
1497- pytest .skip ("no stub data for cbbo-1s schema" )
1498- if schema == "cbbo-1m" :
1499- pytest .skip ("no stub data for cbbo-1m schema" )
1500- if schema == "tcbbo" :
1501- pytest .skip ("no stub data for tcbbo schema" )
1519+ if schema in (
1520+ "ohlcv-eod" ,
1521+ "imbalance" ,
1522+ "cbbo" ,
1523+ "cbbo-1s" ,
1524+ "cbbo-1m" ,
1525+ "tcbbo" ,
1526+ "bbo-1s" ,
1527+ "bbo-1m" ,
1528+ ):
1529+ pytest .skip (f"no stub data for { schema } schema" )
15021530
15031531 output = tmp_path / "output.dbn"
15041532 live_client .add_stream (output .open ("wb" ))
0 commit comments