From c9e59d8f7df57907dcb6fe5b306b9761ed7ac174 Mon Sep 17 00:00:00 2001 From: Rob Maierle Date: Thu, 7 Aug 2025 15:22:10 -0400 Subject: [PATCH 1/5] ADD: Add missing enums to databento package --- CHANGELOG.md | 5 +++++ databento/__init__.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fa41e2..6d60b23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.60.1 - TBD + +#### Enhancements +- Added export of `SystemCode` and `ErrorCode` from `databento_dbn` to the root `databento` package + ## 0.60.0 - 2025-08-05 #### Enhancements diff --git a/databento/__init__.py b/databento/__init__.py index dbb287f..9d55155 100644 --- a/databento/__init__.py +++ b/databento/__init__.py @@ -13,6 +13,7 @@ from databento_dbn import Compression from databento_dbn import ConsolidatedBidAskPair from databento_dbn import Encoding +from databento_dbn import ErrorCode from databento_dbn import ErrorMsg from databento_dbn import ImbalanceMsg from databento_dbn import InstrumentClass @@ -35,6 +36,7 @@ from databento_dbn import StatusReason from databento_dbn import SType from databento_dbn import SymbolMappingMsg +from databento_dbn import SystemCode from databento_dbn import SystemMsg from databento_dbn import TradeMsg from databento_dbn import TradingEvent @@ -102,6 +104,7 @@ "Dataset", "Delivery", "Encoding", + "ErrorCode", "ErrorMsg", "FeedMode", "Historical", @@ -137,6 +140,7 @@ "StatusReason", "SymbolMappingMsg", "SymbologyResolution", + "SystemCode", "SystemMsg", "TBBOMsg", "TBBOMsg", From 88e367b4d59de36e64ca0f196d34cf4428f01b66 Mon Sep 17 00:00:00 2001 From: Rob Maierle Date: Fri, 8 Aug 2025 14:39:42 -0400 Subject: [PATCH 2/5] FIX: Update minimum requests version --- CHANGELOG.md | 3 +++ pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d60b23..396595d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ #### Enhancements - Added export of `SystemCode` and `ErrorCode` from `databento_dbn` to the root `databento` package +#### Bug fixes +- Bumped the minimum version requirement for `requests` to 0.27.0 + ## 0.60.0 - 2025-08-05 #### Enhancements diff --git a/pyproject.toml b/pyproject.toml index 91c03f2..87d0e7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ numpy = [ pandas = ">=1.5.3" pip-system-certs = {version=">=4.0", markers="platform_system == 'Windows'"} pyarrow = ">=13.0.0" -requests = ">=2.25.1" +requests = ">=2.27.0" zstandard = ">=0.21.0" [tool.poetry.group.dev.dependencies] From 35444484abe1c4ee7fb09be2e998e37a23307d0c Mon Sep 17 00:00:00 2001 From: Rob Maierle Date: Wed, 6 Aug 2025 15:47:43 -0400 Subject: [PATCH 3/5] DEL: Remove unused received variant --- CHANGELOG.md | 10 +++++++--- databento/__init__.py | 2 ++ databento/common/enums.py | 17 +++++++++++++++-- databento/common/parsing.py | 27 +++++++++++++++++++++++++++ databento/historical/api/batch.py | 10 ++++++---- tests/test_historical_batch.py | 2 +- 6 files changed, 58 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 396595d..bf529c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog -## 0.60.1 - TBD +## 0.61.0 - TBD + +#### Breaking changes +- Modified the `states` parameter in `batch.list_jobs()` #### Enhancements +- Added `JobState` enum - Added export of `SystemCode` and `ErrorCode` from `databento_dbn` to the root `databento` package #### Bug fixes @@ -58,8 +62,8 @@ Python - "ICE Futures Europe (Financials)" renamed to "ICE Europe Financials" - "ICE Futures Europe (Commodities)" renamed to "ICE Europe Commodities" - Upgraded `databento-dbn` to 0.36.1 - - Fixed setting of ts_out property of DbnFsm based on decoded metadata. This -was preventing ts_out from being correctly decoded in the Python DBNDecoder + - Fixed setting of `ts_out` property of DbnFsm based on decoded metadata. This +was preventing `ts_out` from being correctly decoded in the Python DBNDecoder - Fixed decoding of `ts_out` with first records in DBNDecoder #### Bug fixes diff --git a/databento/__init__.py b/databento/__init__.py index 9d55155..0b267c3 100644 --- a/databento/__init__.py +++ b/databento/__init__.py @@ -57,6 +57,7 @@ from databento.common.enums import Delivery from databento.common.enums import FeedMode from databento.common.enums import HistoricalGateway +from databento.common.enums import JobState from databento.common.enums import Packaging from databento.common.enums import ReconnectPolicy from databento.common.enums import RecordFlags @@ -113,6 +114,7 @@ "InstrumentClass", "InstrumentDefMsg", "InstrumentMap", + "JobState", "Live", "MBOMsg", "MBP1Msg", diff --git a/databento/common/enums.py b/databento/common/enums.py index 7fd5bd7..6c81356 100644 --- a/databento/common/enums.py +++ b/databento/common/enums.py @@ -28,7 +28,7 @@ def coercible(enum_type: type[M]) -> type[M]: Parameters ---------- enum_type : EnumMeta - The deocrated Enum type. + The decorated Enum type. Returns ------- @@ -167,7 +167,7 @@ class RollRule(StringyMixin, str, Enum): """ VOLUME = "volume" - OPEN_INTEREST = "open_interst" + OPEN_INTEREST = "open_interest" CALENDAR = "calendar" @@ -241,3 +241,16 @@ class PriceType(StringyMixin, str, Enum): FIXED = "fixed" FLOAT = "float" DECIMAL = "decimal" + + +@unique +@coercible +class JobState(StringyMixin, str, Enum): + """ + Represents the different states for batch jobs. + """ + + QUEUED = "queued" + PROCESSING = "processing" + DONE = "done" + EXPIRED = "expired" diff --git a/databento/common/parsing.py b/databento/common/parsing.py index 7a9d918..0c3caf8 100644 --- a/databento/common/parsing.py +++ b/databento/common/parsing.py @@ -17,6 +17,8 @@ from databento_dbn import SType from databento.common.constants import ALL_SYMBOLS +from databento.common.enums import JobState +from databento.common.validation import validate_enum from databento.common.validation import validate_smart_symbol @@ -64,6 +66,31 @@ def optional_values_list_to_string( return values_list_to_string(values) +def optional_states_list_to_string( + states: Iterable[JobState | str] | JobState | str | None, +) -> str | None: + """ + Concatenate a states string or iterable of string states (if not None). + + Parameters + ---------- + states : Iterable[JobState | str] | JobState | str | None + The states to concatenate. + + Returns + ------- + str or `None` + + """ + if states is None: + return None + elif isinstance(states, (JobState, str)): + return str(states) + else: + states_list = [validate_enum(state, JobState, "state").value for state in states] + return ",".join(states_list) + + def optional_string_to_list( value: Iterable[str] | str | None, ) -> Iterable[str] | list[str] | None: diff --git a/databento/historical/api/batch.py b/databento/historical/api/batch.py index 70f9dc9..a74ed8d 100644 --- a/databento/historical/api/batch.py +++ b/databento/historical/api/batch.py @@ -29,6 +29,7 @@ from databento.common import API_VERSION from databento.common.constants import HTTP_STREAMING_READ_SIZE from databento.common.enums import Delivery +from databento.common.enums import JobState from databento.common.enums import SplitDuration from databento.common.error import BentoError from databento.common.error import BentoHttpError @@ -37,7 +38,7 @@ from databento.common.http import check_http_error from databento.common.parsing import datetime_to_string from databento.common.parsing import optional_datetime_to_string -from databento.common.parsing import optional_values_list_to_string +from databento.common.parsing import optional_states_list_to_string from databento.common.parsing import symbols_list_to_list from databento.common.publishers import Dataset from databento.common.validation import validate_enum @@ -185,7 +186,7 @@ def submit_job( def list_jobs( self, - states: Iterable[str] | str = "received,queued,processing,done", + states: Iterable[JobState | str] | JobState | str | None = "queued,processing,done", since: pd.Timestamp | datetime | date | str | int | None = None, ) -> list[dict[str, Any]]: """ @@ -197,8 +198,9 @@ def list_jobs( Parameters ---------- - states : Iterable[str] or str, optional {'received', 'queued', 'processing', 'done', 'expired'} # noqa + states : Iterable[JobState | str] or JobState or str, optional {'queued', 'processing', 'done', 'expired'} # noqa The filter for jobs states as an iterable of comma separated values. + Defaults to all except 'expired'. since : pd.Timestamp, datetime, date, str, or int, optional The filter for timestamp submitted (will not include jobs prior to this). @@ -209,7 +211,7 @@ def list_jobs( """ params: list[tuple[str, str | None]] = [ - ("states", optional_values_list_to_string(states)), + ("states", optional_states_list_to_string(states)), ("since", optional_datetime_to_string(since)), ] diff --git a/tests/test_historical_batch.py b/tests/test_historical_batch.py index 6ed1faf..f0d89ab 100644 --- a/tests/test_historical_batch.py +++ b/tests/test_historical_batch.py @@ -125,7 +125,7 @@ def test_batch_list_jobs_sends_expected_request( assert call["headers"]["accept"] == "application/json" assert all(v in call["headers"]["user-agent"] for v in ("Databento/", "Python/")) assert call["params"] == [ - ("states", "received,queued,processing,done"), + ("states", "queued,processing,done"), ("since", "2022-01-01"), ] assert call["timeout"] == (100, 100) From f51133b5ca2f5ee2e8d1f4eb46100921469e5155 Mon Sep 17 00:00:00 2001 From: Carter Green Date: Mon, 11 Aug 2025 22:07:41 +0000 Subject: [PATCH 4/5] ADD: Add PUBLISHER_SPECIFIC flag --- CHANGELOG.md | 1 + databento/common/enums.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf529c6..8094f79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ #### Enhancements - Added `JobState` enum - Added export of `SystemCode` and `ErrorCode` from `databento_dbn` to the root `databento` package +- Added `F_PUBLISHER_SPECIFIC` flag to `RecordFlags` enum #### Bug fixes - Bumped the minimum version requirement for `requests` to 0.27.0 diff --git a/databento/common/enums.py b/databento/common/enums.py index 6c81356..a8be618 100644 --- a/databento/common/enums.py +++ b/databento/common/enums.py @@ -207,6 +207,8 @@ class RecordFlags(StringyMixin, IntFlag): # type: ignore The `ts_recv` value is inaccurate (clock issues or reordering). F_MAYBE_BAD_BOOK Indicates an unrecoverable gap was detected in the channel. + F_PUBLISHER_SPECIFIC + Indicates a publisher-specific event. Other bits are reserved and have no current meaning. @@ -218,6 +220,7 @@ class RecordFlags(StringyMixin, IntFlag): # type: ignore F_MBP = 16 F_BAD_TS_RECV = 8 F_MAYBE_BAD_BOOK = 4 + F_PUBLISHER_SPECIFIC = 2 @unique From 611d773fd22be2543a213a9ea5a4e550e2f4f8e2 Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Tue, 12 Aug 2025 09:18:40 -0700 Subject: [PATCH 5/5] VER: Release 0.61.0 --- CHANGELOG.md | 2 +- databento/version.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8094f79..2d1e7a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.61.0 - TBD +## 0.61.0 - 2025-08-12 #### Breaking changes - Modified the `states` parameter in `batch.list_jobs()` diff --git a/databento/version.py b/databento/version.py index 5684ec7..a076e5d 100644 --- a/databento/version.py +++ b/databento/version.py @@ -1 +1 @@ -__version__ = "0.60.0" +__version__ = "0.61.0" diff --git a/pyproject.toml b/pyproject.toml index 87d0e7f..1443d76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "databento" -version = "0.60.0" +version = "0.61.0" description = "Official Python client library for Databento" authors = [ "Databento ",