Skip to content
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
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.61.0 - 2025-08-12

#### 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
- Added `F_PUBLISHER_SPECIFIC` flag to `RecordFlags` enum

#### Bug fixes
- Bumped the minimum version requirement for `requests` to 0.27.0

## 0.60.0 - 2025-08-05

#### Enhancements
Expand Down Expand Up @@ -50,8 +63,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
Expand Down
6 changes: 6 additions & 0 deletions databento/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -55,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
Expand Down Expand Up @@ -102,6 +105,7 @@
"Dataset",
"Delivery",
"Encoding",
"ErrorCode",
"ErrorMsg",
"FeedMode",
"Historical",
Expand All @@ -110,6 +114,7 @@
"InstrumentClass",
"InstrumentDefMsg",
"InstrumentMap",
"JobState",
"Live",
"MBOMsg",
"MBP1Msg",
Expand Down Expand Up @@ -137,6 +142,7 @@
"StatusReason",
"SymbolMappingMsg",
"SymbologyResolution",
"SystemCode",
"SystemMsg",
"TBBOMsg",
"TBBOMsg",
Expand Down
20 changes: 18 additions & 2 deletions databento/common/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down Expand Up @@ -167,7 +167,7 @@ class RollRule(StringyMixin, str, Enum):
"""

VOLUME = "volume"
OPEN_INTEREST = "open_interst"
OPEN_INTEREST = "open_interest"
CALENDAR = "calendar"


Expand Down Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -241,3 +244,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"
27 changes: 27 additions & 0 deletions databento/common/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions databento/historical/api/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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]]:
"""
Expand All @@ -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).

Expand All @@ -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)),
]

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.60.0"
__version__ = "0.61.0"
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <support@databento.com>",
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_historical_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading