Skip to content

Commit b0d5243

Browse files
committed
ADD: Python reconnect feature
1 parent aebd470 commit b0d5243

File tree

13 files changed

+674
-274
lines changed

13 files changed

+674
-274
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# Changelog
22

3-
## 0.37.1 - TBD
3+
## 0.38.0 - TBD
4+
5+
This release adds a new feature to the `Live` client for automatically reconnecting when an unexpected disconnection occurs.
46

57
#### Enhancements
8+
- Added `ReconnectPolicy` enumeration
9+
- Added `reconnect_policy` parameter to the `Live` client to specify client reconnection behavior
10+
- Added `Live.add_reconnect_callback` method for specifying a callback to handle client reconnections
611
- Added platform information to the user agent reported by the `Historical` and `Live` clients
712

13+
#### Breaking changes
14+
- Calling `Live.stop` will now clear all user streams and callbacks
15+
- Renamed `Session` to `LiveSession` in the `databento.live.session` module
16+
817
## 0.37.0 - 2024-07-09
918

1019
#### Enhancements

databento/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from databento.common.enums import FeedMode
2727
from databento.common.enums import HistoricalGateway
2828
from databento.common.enums import Packaging
29+
from databento.common.enums import ReconnectPolicy
2930
from databento.common.enums import RecordFlags
3031
from databento.common.enums import RollRule
3132
from databento.common.enums import SplitDuration
@@ -70,6 +71,7 @@
7071
"InstrumentMap",
7172
"Live",
7273
"Packaging",
74+
"ReconnectPolicy",
7375
"RollRule",
7476
"Schema",
7577
"SplitDuration",

databento/common/enums.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,10 @@ class RecordFlags(StringyMixin, IntFlag): # type: ignore
220220
F_MBP = 16
221221
F_BAD_TS_RECV = 8
222222
F_MAYBE_BAD_BOOK = 4
223+
224+
225+
@unique
226+
@coercible
227+
class ReconnectPolicy(StringyMixin, str, Enum):
228+
NONE = "none"
229+
RECONNECT = "reconnect"

databento/common/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import Union
77

88
import databento_dbn
9+
import pandas as pd
910

1011

1112
DBNRecord = Union[
@@ -31,6 +32,7 @@
3132

3233
RecordCallback = Callable[[DBNRecord], None]
3334
ExceptionCallback = Callable[[Exception], None]
35+
ReconnectCallback = Callable[[pd.Timestamp, pd.Timestamp], None]
3436

3537
_T = TypeVar("_T")
3638

0 commit comments

Comments
 (0)