Skip to content

Commit 5592db7

Browse files
authored
VER: Release 0.37.0
See release notes.
2 parents aabd230 + 2eed532 commit 5592db7

File tree

10 files changed

+58
-21
lines changed

10 files changed

+58
-21
lines changed

CHANGELOG.md

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

3+
## 0.37.0 - 2024-07-09
4+
5+
#### Enhancements
6+
- A disconnected `Live` client can now be reused with a different dataset
7+
- Upgraded `databento-dbn` to 0.19.0
8+
39
## 0.36.3 - 2024-07-02
410

511
#### Enhancements

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The library is fully compatible with the latest distribution of Anaconda 3.8 and
3232
The minimum dependencies as found in the `pyproject.toml` are also listed below:
3333
- python = "^3.8"
3434
- aiohttp = "^3.8.3"
35-
- databento-dbn = "0.18.2"
35+
- databento-dbn = "0.19.0"
3636
- numpy= ">=1.23.5"
3737
- pandas = ">=1.5.3"
3838
- pip-system-certs = ">=4.0" (Windows only)

databento/common/constants.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Final
44

55
import numpy as np
6+
from databento_dbn import BBOMsg
67
from databento_dbn import CBBOMsg
78
from databento_dbn import ImbalanceMsg
89
from databento_dbn import InstrumentDefMsg
@@ -47,8 +48,8 @@
4748
Schema.CBBO_1S: CBBOMsg,
4849
Schema.CBBO_1M: CBBOMsg,
4950
Schema.TCBBO: CBBOMsg,
50-
Schema.BBO_1S: MBP1Msg,
51-
Schema.BBO_1M: MBP1Msg,
51+
Schema.BBO_1S: BBOMsg,
52+
Schema.BBO_1M: BBOMsg,
5253
}
5354

5455
SCHEMA_STRUCT_MAP_V1: Final[dict[Schema, type[DBNRecord]]] = {
@@ -69,6 +70,6 @@
6970
Schema.CBBO_1S: CBBOMsg,
7071
Schema.CBBO_1M: CBBOMsg,
7172
Schema.TCBBO: CBBOMsg,
72-
Schema.BBO_1S: MBP1Msg,
73-
Schema.BBO_1M: MBP1Msg,
73+
Schema.BBO_1S: BBOMsg,
74+
Schema.BBO_1M: BBOMsg,
7475
}

databento/common/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010

1111
DBNRecord = Union[
12+
databento_dbn.BBOMsg,
1213
databento_dbn.CBBOMsg,
1314
databento_dbn.MBOMsg,
1415
databento_dbn.MBP1Msg,

databento/live/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ def _cleanup_client(self) -> None:
605605
Cleanup any stateful client data.
606606
"""
607607
self._symbology_map.clear()
608+
self._dataset = ""
608609

609610
to_remove = []
610611
for stream in self._user_streams:

databento/version.py

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

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "databento"
3-
version = "0.36.3"
3+
version = "0.37.0"
44
description = "Official Python client library for Databento"
55
authors = [
66
"Databento <[email protected]>",
@@ -32,7 +32,7 @@ aiohttp = [
3232
{version = "^3.8.3", python = "<3.12"},
3333
{version = "^3.9.0", python = "^3.12"}
3434
]
35-
databento-dbn = "0.18.2"
35+
databento-dbn = "0.19.0"
3636
numpy = [
3737
{version = ">=1.23.5", python = "<3.12"},
3838
{version = "^1.26.0", python = "^3.12"}
-267 Bytes
Binary file not shown.
-268 Bytes
Binary file not shown.

tests/test_live_client.py

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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")
639668
def 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

Comments
 (0)