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,13 +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
470
454
-
455
-
456
471
Raises
457
472
------
458
473
ValueError
@@ -497,17 +512,23 @@ def subscribe(
497
512
498
513
defterminate(self) ->None:
499
514
"""
500
-
Terminate the live client session and stop processing records as soon
501
-
as possible.
515
+
Terminate the session and stop processing records immediately.
516
+
517
+
A client can only be terminated after a connection is started with `Live.start`.
518
+
519
+
Once terminated, the client can be reused, but the session state
520
+
is not preserved.
502
521
503
522
Raises
504
523
------
505
524
ValueError
506
-
If the client is not connected.
525
+
If called before a connection has started.
507
526
508
527
See Also
509
528
--------
510
529
Live.stop
530
+
Live.block_for_close
531
+
Live.wait_for_close
511
532
512
533
"""
513
534
logger.info("terminating live client")
@@ -521,11 +542,14 @@ def block_for_close(
521
542
) ->None:
522
543
"""
523
544
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.
545
+
close after the remote gateway disconnects, or after `Live.stop` or
546
+
`Live.terminate` are called.
525
547
526
-
If a `timeout` is specified, `Live.stop` will be called when the
548
+
If a `timeout` is specified, `Live.terminate` will be called when the
527
549
timeout is reached.
528
550
551
+
When this method unblocks, the session is guaranteed to be closed.
552
+
529
553
Parameters
530
554
----------
531
555
timeout : float, optional
@@ -541,7 +565,7 @@ def block_for_close(
541
565
542
566
See Also
543
567
--------
544
-
wait_for_close
568
+
Live.wait_for_close
545
569
546
570
"""
547
571
try:
@@ -565,12 +589,14 @@ async def wait_for_close(
565
589
) ->None:
566
590
"""
567
591
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.
592
+
session will close when the remote gateway disconnects, or after
593
+
`Live.stop` or `Live.terminate` are called.
570
594
571
-
If a `timeout` is specified, `Live.stop` will be called when the
595
+
If a `timeout` is specified, `Live.terminate` will be called when the
572
596
timeout is reached.
573
597
598
+
When this method unblocks, the session is guaranteed to be closed.
0 commit comments