From 2d41f84654a4f68fa2a9c178619885ae24e50941 Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Wed, 12 Jun 2024 12:15:25 -0700 Subject: [PATCH 1/6] ADD: Type alias TBBOMsg for MBP1Msg --- CHANGELOG.md | 5 +++++ databento/__init__.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c9a48..e981d6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.36.1 - TBD + +#### Enhancements +- Added type alias `TBBOMsg` for `MBP1Msg` + ## 0.36.0 - 2024-06-11 #### Enhancements diff --git a/databento/__init__.py b/databento/__init__.py index 36de5d7..55787b0 100644 --- a/databento/__init__.py +++ b/databento/__init__.py @@ -44,6 +44,10 @@ from databento.version import __version__ # noqa +# Alias for convenience +TBBOMsg = MBP1Msg + + __all__ = [ "API_VERSION", "DBNStore", From 77f7f3b835cf78d5798290aae2a77a005742abd2 Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Fri, 14 Jun 2024 15:11:04 -0700 Subject: [PATCH 2/6] MOD: Call Live.stop on garbage collection --- CHANGELOG.md | 1 + databento/live/client.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e981d6b..ef57649 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ #### Enhancements - Added type alias `TBBOMsg` for `MBP1Msg` +- Instances of the `Live` client will now call `Live.stop` when garbage collected ## 0.36.0 - 2024-06-11 diff --git a/databento/live/client.py b/databento/live/client.py index 846bceb..00e5038 100644 --- a/databento/live/client.py +++ b/databento/live/client.py @@ -121,6 +121,12 @@ def factory() -> _SessionProtocol: if not Live._thread.is_alive(): Live._thread.start() + def __del__(self) -> None: + try: + self.stop() + except ValueError: + pass + def __aiter__(self) -> LiveIterator: return iter(self) From fa9de8c7ebaaa0c0ad3829063dc2ee5c74eca1b4 Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Mon, 17 Jun 2024 11:02:53 -0700 Subject: [PATCH 3/6] MOD: Live __del__ to catch AttributeError --- databento/live/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/databento/live/client.py b/databento/live/client.py index 00e5038..a203ec5 100644 --- a/databento/live/client.py +++ b/databento/live/client.py @@ -124,7 +124,7 @@ def factory() -> _SessionProtocol: def __del__(self) -> None: try: self.stop() - except ValueError: + except (AttributeError, ValueError): pass def __aiter__(self) -> LiveIterator: From 2814e04345761360ea6efd57d253e1b9e16cf011 Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Mon, 17 Jun 2024 10:56:54 -0700 Subject: [PATCH 4/6] ADD: Add stub data for BBO-1s BBO-1m and Status --- databento/common/constants.py | 9 +++++++++ tests/data/GLBX.MDP3/test_data.bbo-1m.dbn.zst | Bin 0 -> 267 bytes tests/data/GLBX.MDP3/test_data.bbo-1s.dbn.zst | Bin 0 -> 268 bytes tests/data/GLBX.MDP3/test_data.status.dbn.zst | Bin 0 -> 188 bytes tests/data/generator.py | 3 +++ tests/test_live_client.py | 7 ------- 6 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 tests/data/GLBX.MDP3/test_data.bbo-1m.dbn.zst create mode 100644 tests/data/GLBX.MDP3/test_data.bbo-1s.dbn.zst create mode 100644 tests/data/GLBX.MDP3/test_data.status.dbn.zst diff --git a/databento/common/constants.py b/databento/common/constants.py index f2f228c..8309694 100644 --- a/databento/common/constants.py +++ b/databento/common/constants.py @@ -13,6 +13,7 @@ from databento_dbn import OHLCVMsg from databento_dbn import Schema from databento_dbn import StatMsg +from databento_dbn import StatusMsg from databento_dbn import TradeMsg from databento.common.types import DBNRecord @@ -39,6 +40,7 @@ Schema.OHLCV_1D: OHLCVMsg, Schema.OHLCV_EOD: OHLCVMsg, Schema.STATISTICS: StatMsg, + Schema.STATUS: StatusMsg, Schema.TBBO: MBP1Msg, Schema.TRADES: TradeMsg, Schema.CBBO: CBBOMsg, @@ -60,6 +62,13 @@ Schema.OHLCV_1H: OHLCVMsg, Schema.OHLCV_1D: OHLCVMsg, Schema.STATISTICS: StatMsg, + Schema.STATUS: StatusMsg, Schema.TBBO: MBP1Msg, Schema.TRADES: TradeMsg, + Schema.CBBO: CBBOMsg, + Schema.CBBO_1S: CBBOMsg, + Schema.CBBO_1M: CBBOMsg, + Schema.TCBBO: CBBOMsg, + Schema.BBO_1S: MBP1Msg, + Schema.BBO_1M: MBP1Msg, } diff --git a/tests/data/GLBX.MDP3/test_data.bbo-1m.dbn.zst b/tests/data/GLBX.MDP3/test_data.bbo-1m.dbn.zst new file mode 100644 index 0000000000000000000000000000000000000000..d8d6c5a377ca431fe260dff756c63e179057c84a GIT binary patch literal 267 zcmV+m0rdVTwJ-eySlkBy0?aHkKvT5_8|7=Pv@eM}1C-U&b-Tdf7g!rTNcw?-8b0NY za66)5Y0zSh6B>rRr#^IhvdI*`^hZlIFWPtvCY`t5!bk`N{Q@!Hx!f{EydD~rbO2d! zf&7!byo8FSspW5>o#CJZ|MVL?B^3}V=jnL!wQznikw*b79c4BWsE?A9uR5M92NwkP zFfnbKm`3o=9XyNfpWmMYSQilt3&~qy=c^Gvb*P;dY} R21f&!89*2T008rIh=2N3a*+T4 literal 0 HcmV?d00001 diff --git a/tests/data/GLBX.MDP3/test_data.bbo-1s.dbn.zst b/tests/data/GLBX.MDP3/test_data.bbo-1s.dbn.zst new file mode 100644 index 0000000000000000000000000000000000000000..06d165a42373f4a2246fb8acbea86558f4f56988 GIT binary patch literal 268 zcmV+n0rUPSwJ-eySmXx)qDw3@KvT5_8|7=Pv@eM}1C-U&b-Tdfr!-Yez(2^SLPxbH z#h!dp9<-R_goXk4)Q9eElE@Ul^hZlIAKG*bCY`t4!bk`N{Q)u0xm+?OydD~qG{8t; zf&7ELyo8FSspM;*o#CJY|3pUxgjzloZ@iZB2NQXe&r(rlBf;RK0X$lWk+}&Xe*ayKN#8Lzx&=d$*WsPwMQ(H6K7%jD~1OQ#M0tybG S$KYrHGXn?%0RRBkSYU&wlX}Yl literal 0 HcmV?d00001 diff --git a/tests/data/GLBX.MDP3/test_data.status.dbn.zst b/tests/data/GLBX.MDP3/test_data.status.dbn.zst new file mode 100644 index 0000000000000000000000000000000000000000..1ef5d7adf7e3a14cbf7216e3fa8451f144fe36b0 GIT binary patch literal 188 zcmdPcs{fZIB88Pfg~P?kk13Lofx+F!DMHWJCBT@0n}LDB!Pt98h!_Jy|B?G_p<*ly zAO#?T!8O>!5X|7QH(}%jVp9_fBQ7CEhAdH_Y(hH|>(&r4_Q=ROkIDP){S6V*{q&E~ z@5o%gmH$G-4(Y55TKSK$;GowAATPJqz#Bxf2{3%Spu0f)fSg72s!q{HZ*Bu+_P(;r cwdITs;%gh4m|qxLNF6xCa0qBU+rw^U0BY(tj{pDw literal 0 HcmV?d00001 diff --git a/tests/data/generator.py b/tests/data/generator.py index 581eb79..252e4f9 100644 --- a/tests/data/generator.py +++ b/tests/data/generator.py @@ -29,6 +29,8 @@ (Schema.MBO, ["ESH1"], "2020-12-28"), (Schema.MBP_1, ["ESH1"], "2020-12-28"), (Schema.MBP_10, ["ESH1"], "2020-12-28"), + (Schema.BBO_1S, ["ESH1"], "2020-12-28"), + (Schema.BBO_1M, ["ESH1"], "2020-12-28"), (Schema.TBBO, ["ESH1"], "2020-12-28"), (Schema.TRADES, ["ESH1"], "2020-12-28"), (Schema.OHLCV_1S, ["ESH1"], "2020-12-28"), @@ -37,6 +39,7 @@ (Schema.OHLCV_1D, ["ESH1"], "2020-12-28"), (Schema.DEFINITION, ["ESH1"], "2020-12-28"), (Schema.STATISTICS, ["ESH1"], "2020-12-28"), + (Schema.STATUS, ["ESH1"], "2020-12-28"), ], Dataset.XNAS_ITCH: [ (Schema.MBO, ["NVDA"], "2020-12-28"), diff --git a/tests/test_live_client.py b/tests/test_live_client.py index c42c418..70782c8 100644 --- a/tests/test_live_client.py +++ b/tests/test_live_client.py @@ -1487,9 +1487,6 @@ async def test_live_stream_with_reconnect( """ # Arrange - # TODO: Remove when status schema is available - if schema == "status": - pytest.skip("no stub data for status schema") if schema == "ohlcv-eod": pytest.skip("no stub data for ohlcv-eod schema") if schema == "imbalance": @@ -1500,10 +1497,6 @@ async def test_live_stream_with_reconnect( pytest.skip("no stub data for cbbo-1s schema") if schema == "cbbo-1m": pytest.skip("no stub data for cbbo-1m schema") - if schema == "bbo-1s": - pytest.skip("no stub data for bbo-1s schema") - if schema == "bbo-1m": - pytest.skip("no stub data for bbo-1m schema") if schema == "tcbbo": pytest.skip("no stub data for tcbbo schema") From 8213d4ebb1a132564079496a29a4d34e61817933 Mon Sep 17 00:00:00 2001 From: Renan Gemignani Date: Tue, 18 Jun 2024 15:35:00 +0200 Subject: [PATCH 5/6] ADD: Add new NLS publishers for XBOS/XPSX --- CHANGELOG.md | 1 + databento/common/publishers.py | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef57649..16ec4a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ #### Enhancements - Added type alias `TBBOMsg` for `MBP1Msg` - Instances of the `Live` client will now call `Live.stop` when garbage collected +- Added new publisher values for `XNAS.BASIC` and `XNAS.NLS` ## 0.36.0 - 2024-06-11 diff --git a/databento/common/publishers.py b/databento/common/publishers.py index 2a0e07a..a318256 100644 --- a/databento/common/publishers.py +++ b/databento/common/publishers.py @@ -914,6 +914,14 @@ class Publisher(StringyMixin, str, Enum): ICE Futures Europe - Off-Market Trades. NDEX_IMPACT_XOFF ICE Endex - Off-Market Trades. + XNAS_NLS_XBOS + Nasdaq NLS - Nasdaq BX. + XNAS_NLS_XPSX + Nasdaq NLS - Nasdaq PSX. + XNAS_BASIC_XBOS + Nasdaq Basic - Nasdaq BX. + XNAS_BASIC_XPSX + Nasdaq Basic - Nasdaq PSX. """ @@ -1002,6 +1010,10 @@ class Publisher(StringyMixin, str, Enum): XNAS_BASIC_FINC = "XNAS.BASIC.FINC" IFEU_IMPACT_XOFF = "IFEU.IMPACT.XOFF" NDEX_IMPACT_XOFF = "NDEX.IMPACT.XOFF" + XNAS_NLS_XBOS = "XNAS.NLS.XBOS" + XNAS_NLS_XPSX = "XNAS.NLS.XPSX" + XNAS_BASIC_XBOS = "XNAS.BASIC.XBOS" + XNAS_BASIC_XPSX = "XNAS.BASIC.XPSX" @classmethod def from_int(cls, value: int) -> Publisher: @@ -1178,6 +1190,14 @@ def from_int(cls, value: int) -> Publisher: return Publisher.IFEU_IMPACT_XOFF if value == 85: return Publisher.NDEX_IMPACT_XOFF + if value == 86: + return Publisher.XNAS_NLS_XBOS + if value == 87: + return Publisher.XNAS_NLS_XPSX + if value == 88: + return Publisher.XNAS_BASIC_XBOS + if value == 89: + return Publisher.XNAS_BASIC_XPSX raise ValueError(f"Integer value {value} does not correspond with any Publisher variant") def to_int(self) -> int: @@ -1354,6 +1374,14 @@ def to_int(self) -> int: return 84 if self == Publisher.NDEX_IMPACT_XOFF: return 85 + if self == Publisher.XNAS_NLS_XBOS: + return 86 + if self == Publisher.XNAS_NLS_XPSX: + return 87 + if self == Publisher.XNAS_BASIC_XBOS: + return 88 + if self == Publisher.XNAS_BASIC_XPSX: + return 89 raise ValueError("Invalid Publisher") @property @@ -1531,6 +1559,14 @@ def venue(self) -> Venue: return Venue.XOFF if self == Publisher.NDEX_IMPACT_XOFF: return Venue.XOFF + if self == Publisher.XNAS_NLS_XBOS: + return Venue.XBOS + if self == Publisher.XNAS_NLS_XPSX: + return Venue.XPSX + if self == Publisher.XNAS_BASIC_XBOS: + return Venue.XBOS + if self == Publisher.XNAS_BASIC_XPSX: + return Venue.XPSX raise ValueError("Unexpected Publisher value") @property @@ -1708,6 +1744,14 @@ def dataset(self) -> Dataset: return Dataset.IFEU_IMPACT if self == Publisher.NDEX_IMPACT_XOFF: return Dataset.NDEX_IMPACT + if self == Publisher.XNAS_NLS_XBOS: + return Dataset.XNAS_NLS + if self == Publisher.XNAS_NLS_XPSX: + return Dataset.XNAS_NLS + if self == Publisher.XNAS_BASIC_XBOS: + return Dataset.XNAS_BASIC + if self == Publisher.XNAS_BASIC_XPSX: + return Dataset.XNAS_BASIC raise ValueError("Unexpected Publisher value") @property @@ -1885,4 +1929,12 @@ def description(self) -> str: return "ICE Futures Europe - Off-Market Trades" if self == Publisher.NDEX_IMPACT_XOFF: return "ICE Endex - Off-Market Trades" + if self == Publisher.XNAS_NLS_XBOS: + return "Nasdaq NLS - Nasdaq BX" + if self == Publisher.XNAS_NLS_XPSX: + return "Nasdaq NLS - Nasdaq PSX" + if self == Publisher.XNAS_BASIC_XBOS: + return "Nasdaq Basic - Nasdaq BX" + if self == Publisher.XNAS_BASIC_XPSX: + return "Nasdaq Basic - Nasdaq PSX" raise ValueError("Unexpected Publisher value") From 201eb43c9c7be7a516c0c9882870917452e64c77 Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Mon, 17 Jun 2024 14:45:07 -0700 Subject: [PATCH 6/6] VER: Release 0.36.1 --- CHANGELOG.md | 3 ++- databento/version.py | 2 +- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16ec4a7..25422c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Changelog -## 0.36.1 - TBD +## 0.36.1 - 2024-06-18 #### Enhancements - Added type alias `TBBOMsg` for `MBP1Msg` +- Added support for `BBO-1s`, `BBO-1m`, and `Status` schemas - Instances of the `Live` client will now call `Live.stop` when garbage collected - Added new publisher values for `XNAS.BASIC` and `XNAS.NLS` diff --git a/databento/version.py b/databento/version.py index d9f2629..ef5853c 100644 --- a/databento/version.py +++ b/databento/version.py @@ -1 +1 @@ -__version__ = "0.36.0" +__version__ = "0.36.1" diff --git a/pyproject.toml b/pyproject.toml index 0321f0a..ded9222 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "databento" -version = "0.36.0" +version = "0.36.1" description = "Official Python client library for Databento" authors = [ "Databento ",