Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VER: Release 0.36.1 #59

Merged
merged 6 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 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`

## 0.36.0 - 2024-06-11

#### Enhancements
Expand Down
4 changes: 4 additions & 0 deletions databento/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
from databento.version import __version__ # noqa


# Alias for convenience
TBBOMsg = MBP1Msg


__all__ = [
"API_VERSION",
"DBNStore",
Expand Down
9 changes: 9 additions & 0 deletions databento/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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,
}
52 changes: 52 additions & 0 deletions databento/common/publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

"""

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
6 changes: 6 additions & 0 deletions databento/live/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ def factory() -> _SessionProtocol:
if not Live._thread.is_alive():
Live._thread.start()

def __del__(self) -> None:
try:
self.stop()
except (AttributeError, ValueError):
pass

def __aiter__(self) -> LiveIterator:
return iter(self)

Expand Down
2 changes: 1 addition & 1 deletion databento/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.36.0"
__version__ = "0.36.1"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down
Binary file added tests/data/GLBX.MDP3/test_data.bbo-1m.dbn.zst
Binary file not shown.
Binary file added tests/data/GLBX.MDP3/test_data.bbo-1s.dbn.zst
Binary file not shown.
Binary file added tests/data/GLBX.MDP3/test_data.status.dbn.zst
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/data/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down
7 changes: 0 additions & 7 deletions tests/test_live_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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")

Expand Down
Loading