Skip to content

Commit 39a9e36

Browse files
authored
VER: Release 0.39.3
See release notes.
2 parents ee5d7bc + 60d58e5 commit 39a9e36

File tree

6 files changed

+72
-18
lines changed

6 files changed

+72
-18
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 0.39.3 - 2024-08-20
4+
5+
#### Enhancements
6+
- Added new publisher values for `XCIS.BBOTRADES` and `XNYS.BBOTRADES`
7+
8+
#### Bug fixes
9+
- Fixed an issue receiving multiple DBN v1 `ErrorMsg` in the `Live` client would cause an `InvalidState` error
10+
- Fixed an issue where creating `Live` clients in multiple threads could cause a `RuntimeError` upon initialization
11+
312
## 0.39.2 - 2024-08-13
413

514
#### Enhancements

databento/common/publishers.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,13 @@ class Dataset(StringyMixin, str, Enum):
495495
DBEQ_MAX
496496
Databento Equities Max.
497497
XNAS_BASIC
498-
Nasdaq Basic (NLS+QBBO).
498+
Nasdaq Basic (NLS and QBBO).
499499
DBEQ_SUMMARY
500500
Databento Equities Summary.
501+
XCIS_BBOTRADES
502+
NYSE National BBO and Trades.
503+
XNYS_BBOTRADES
504+
NYSE BBO and Trades.
501505
502506
"""
503507

@@ -533,6 +537,8 @@ class Dataset(StringyMixin, str, Enum):
533537
DBEQ_MAX = "DBEQ.MAX"
534538
XNAS_BASIC = "XNAS.BASIC"
535539
DBEQ_SUMMARY = "DBEQ.SUMMARY"
540+
XCIS_BBOTRADES = "XCIS.BBOTRADES"
541+
XNYS_BBOTRADES = "XNYS.BBOTRADES"
536542

537543
@classmethod
538544
def from_int(cls, value: int) -> Dataset:
@@ -603,6 +609,10 @@ def from_int(cls, value: int) -> Dataset:
603609
return Dataset.XNAS_BASIC
604610
if value == 32:
605611
return Dataset.DBEQ_SUMMARY
612+
if value == 33:
613+
return Dataset.XCIS_BBOTRADES
614+
if value == 34:
615+
return Dataset.XNYS_BBOTRADES
606616
raise ValueError(f"Integer value {value} does not correspond with any Dataset variant")
607617

608618
def to_int(self) -> int:
@@ -673,6 +683,10 @@ def to_int(self) -> int:
673683
return 31
674684
if self == Dataset.DBEQ_SUMMARY:
675685
return 32
686+
if self == Dataset.XCIS_BBOTRADES:
687+
return 33
688+
if self == Dataset.XNYS_BBOTRADES:
689+
return 34
676690
raise ValueError("Invalid Dataset")
677691

678692
@property
@@ -741,9 +755,13 @@ def description(self) -> str:
741755
if self == Dataset.DBEQ_MAX:
742756
return "Databento Equities Max"
743757
if self == Dataset.XNAS_BASIC:
744-
return "Nasdaq Basic (NLS+QBBO)"
758+
return "Nasdaq Basic (NLS and QBBO)"
745759
if self == Dataset.DBEQ_SUMMARY:
746760
return "Databento Equities Summary"
761+
if self == Dataset.XCIS_BBOTRADES:
762+
return "NYSE National BBO and Trades"
763+
if self == Dataset.XNYS_BBOTRADES:
764+
return "NYSE BBO and Trades"
747765
raise ValueError("Unexpected Dataset value")
748766

749767

@@ -933,6 +951,10 @@ class Publisher(StringyMixin, str, Enum):
933951
Nasdaq Basic - Nasdaq PSX.
934952
DBEQ_SUMMARY_DBEQ
935953
Databento Equities Summary.
954+
XCIS_BBOTRADES_XCIS
955+
NYSE National BBO and Trades.
956+
XNYS_BBOTRADES_XNYS
957+
NYSE BBO and Trades.
936958
937959
"""
938960

@@ -1026,6 +1048,8 @@ class Publisher(StringyMixin, str, Enum):
10261048
XNAS_BASIC_XBOS = "XNAS.BASIC.XBOS"
10271049
XNAS_BASIC_XPSX = "XNAS.BASIC.XPSX"
10281050
DBEQ_SUMMARY_DBEQ = "DBEQ.SUMMARY.DBEQ"
1051+
XCIS_BBOTRADES_XCIS = "XCIS.BBOTRADES.XCIS"
1052+
XNYS_BBOTRADES_XNYS = "XNYS.BBOTRADES.XNYS"
10291053

10301054
@classmethod
10311055
def from_int(cls, value: int) -> Publisher:
@@ -1212,6 +1236,10 @@ def from_int(cls, value: int) -> Publisher:
12121236
return Publisher.XNAS_BASIC_XPSX
12131237
if value == 90:
12141238
return Publisher.DBEQ_SUMMARY_DBEQ
1239+
if value == 91:
1240+
return Publisher.XCIS_BBOTRADES_XCIS
1241+
if value == 92:
1242+
return Publisher.XNYS_BBOTRADES_XNYS
12151243
raise ValueError(f"Integer value {value} does not correspond with any Publisher variant")
12161244

12171245
def to_int(self) -> int:
@@ -1398,6 +1426,10 @@ def to_int(self) -> int:
13981426
return 89
13991427
if self == Publisher.DBEQ_SUMMARY_DBEQ:
14001428
return 90
1429+
if self == Publisher.XCIS_BBOTRADES_XCIS:
1430+
return 91
1431+
if self == Publisher.XNYS_BBOTRADES_XNYS:
1432+
return 92
14011433
raise ValueError("Invalid Publisher")
14021434

14031435
@property
@@ -1585,6 +1617,10 @@ def venue(self) -> Venue:
15851617
return Venue.XPSX
15861618
if self == Publisher.DBEQ_SUMMARY_DBEQ:
15871619
return Venue.DBEQ
1620+
if self == Publisher.XCIS_BBOTRADES_XCIS:
1621+
return Venue.XCIS
1622+
if self == Publisher.XNYS_BBOTRADES_XNYS:
1623+
return Venue.XNYS
15881624
raise ValueError("Unexpected Publisher value")
15891625

15901626
@property
@@ -1772,6 +1808,10 @@ def dataset(self) -> Dataset:
17721808
return Dataset.XNAS_BASIC
17731809
if self == Publisher.DBEQ_SUMMARY_DBEQ:
17741810
return Dataset.DBEQ_SUMMARY
1811+
if self == Publisher.XCIS_BBOTRADES_XCIS:
1812+
return Dataset.XCIS_BBOTRADES
1813+
if self == Publisher.XNYS_BBOTRADES_XNYS:
1814+
return Dataset.XNYS_BBOTRADES
17751815
raise ValueError("Unexpected Publisher value")
17761816

17771817
@property
@@ -1959,4 +1999,8 @@ def description(self) -> str:
19591999
return "Nasdaq Basic - Nasdaq PSX"
19602000
if self == Publisher.DBEQ_SUMMARY_DBEQ:
19612001
return "Databento Equities Summary"
2002+
if self == Publisher.XCIS_BBOTRADES_XCIS:
2003+
return "NYSE National BBO and Trades"
2004+
if self == Publisher.XNYS_BBOTRADES_XNYS:
2005+
return "NYSE BBO and Trades"
19622006
raise ValueError("Unexpected Publisher value")

databento/live/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class Live:
6161
"""
6262

6363
_loop = asyncio.new_event_loop()
64+
_lock = threading.Lock()
6465
_thread = threading.Thread(
6566
target=_loop.run_forever,
6667
name="databento_live",
@@ -109,8 +110,9 @@ def __init__(
109110

110111
self._session._user_callbacks.append((self._map_symbol, None))
111112

112-
if not Live._thread.is_alive():
113-
Live._thread.start()
113+
with Live._lock:
114+
if not Live._thread.is_alive():
115+
Live._thread.start()
114116

115117
def __del__(self) -> None:
116118
try:

databento/live/protocol.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,16 @@ def connection_lost(self, exc: Exception | None) -> None:
197197
if not self.disconnected.done():
198198
if exc is None:
199199
logger.info("connection closed")
200-
self.disconnected.set_result(None)
200+
if self._error_msgs:
201+
error_msg = ", ".join(self._error_msgs)
202+
if len(self._error_msgs) > 1:
203+
error_msg = f"The following errors occurred: {error_msg}"
204+
self._error_msgs.clear()
205+
self.disconnected.set_exception(
206+
BentoError(error_msg),
207+
)
208+
else:
209+
self.disconnected.set_result(None)
201210
else:
202211
logger.error("connection lost: %s", exc)
203212
self.disconnected.set_exception(exc)
@@ -361,17 +370,7 @@ def _process_dbn(self, data: bytes) -> None:
361370
record.err,
362371
)
363372
self._error_msgs.append(record.err)
364-
if record.is_last:
365-
if len(self._error_msgs) > 1:
366-
errors = ", ".join(self._error_msgs)
367-
error_msg = f"The following errors occurred: {errors}"
368-
else:
369-
error_msg = self._error_msgs[-1]
370-
self._error_msgs.clear()
371-
self.disconnected.set_exception(
372-
BentoError(error_msg),
373-
)
374-
if isinstance(record, databento_dbn.SystemMsg):
373+
elif isinstance(record, databento_dbn.SystemMsg):
375374
if record.is_heartbeat:
376375
logger.debug("gateway heartbeat")
377376
else:

databento/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.39.2"
1+
__version__ = "0.39.3"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "databento"
3-
version = "0.39.2"
3+
version = "0.39.3"
44
description = "Official Python client library for Databento"
55
authors = [
66
"Databento <support@databento.com>",

0 commit comments

Comments
 (0)