You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subscribe to a data stream. Multiple subscription requests can be made
432
-
for a streaming session. Once one subscription has been made, future
433
-
subscriptions must all belong to the same dataset.
444
+
Add a new subscription to the session.
445
+
446
+
All subscriptions must be for the same `dataset`.
447
+
448
+
Multiple subscriptions for different schemas can be made.
434
449
435
-
When creating the first subscription this method will also create
436
-
the TCP connection to the remote gateway. All subscriptions must
437
-
have the same dataset.
450
+
When creating the first subscription, this method will also create
451
+
the TCP connection to the remote gateway.
438
452
439
453
Parameters
440
454
----------
@@ -446,12 +460,14 @@ def subscribe(
446
460
The symbols to subscribe to.
447
461
stype_in : SType or str, default 'raw_symbol'
448
462
The input symbology type to resolve from.
449
-
start : str or int, optional
450
-
UNIX nanosecond epoch timestamp to start streaming from (inclusive), based on `ts_event`. Must be within 24 hours except when requesting the mbo or definition schemas.
463
+
start : pd.Timestamp, datetime, date, str or int, optional
464
+
The inclusive start of subscription replay.
465
+
Pass `0` to request all available data.
466
+
Cannot be specified after the session is started.
467
+
See `Intraday Replay` https://databento.com/docs/api-reference-live/basics/intraday-replay.
451
468
snapshot: bool, default to 'False'
452
469
Request subscription with snapshot. The `start` parameter must be `None`.
453
-
454
-
470
+
Only supported with `mbo` schema.
455
471
456
472
Raises
457
473
------
@@ -497,17 +513,23 @@ def subscribe(
497
513
498
514
defterminate(self) ->None:
499
515
"""
500
-
Terminate the live client session and stop processing records as soon
501
-
as possible.
516
+
Terminate the session and stop processing records immediately.
517
+
518
+
A client can only be terminated after a connection is started with `Live.start`.
519
+
520
+
Once terminated, the client can be reused, but the session state
521
+
is not preserved.
502
522
503
523
Raises
504
524
------
505
525
ValueError
506
-
If the client is not connected.
526
+
If called before a connection has started.
507
527
508
528
See Also
509
529
--------
510
530
Live.stop
531
+
Live.block_for_close
532
+
Live.wait_for_close
511
533
512
534
"""
513
535
logger.info("terminating live client")
@@ -521,11 +543,14 @@ def block_for_close(
521
543
) ->None:
522
544
"""
523
545
Block until the session closes or a timeout is reached. A session will
524
-
close after `Live.stop` is called or the remote gateway disconnects.
546
+
close after the remote gateway disconnects, or after `Live.stop` or
547
+
`Live.terminate` are called.
525
548
526
-
If a `timeout` is specified, `Live.stop` will be called when the
549
+
If a `timeout` is specified, `Live.terminate` will be called when the
527
550
timeout is reached.
528
551
552
+
When this method unblocks, the session is guaranteed to be closed.
553
+
529
554
Parameters
530
555
----------
531
556
timeout : float, optional
@@ -541,7 +566,7 @@ def block_for_close(
541
566
542
567
See Also
543
568
--------
544
-
wait_for_close
569
+
Live.wait_for_close
545
570
546
571
"""
547
572
try:
@@ -565,12 +590,14 @@ async def wait_for_close(
565
590
) ->None:
566
591
"""
567
592
Coroutine to wait until the session closes or a timeout is reached. A
568
-
session will close after `Live.stop` is called or the remote gateway
569
-
disconnects.
593
+
session will close when the remote gateway disconnects, or after
594
+
`Live.stop` or `Live.terminate` are called.
570
595
571
-
If a `timeout` is specified, `Live.stop` will be called when the
596
+
If a `timeout` is specified, `Live.terminate` will be called when the
572
597
timeout is reached.
573
598
599
+
When this method unblocks, the session is guaranteed to be closed.
0 commit comments