Skip to content

Commit e825079

Browse files
authored
VER: Release 0.43.0
2 parents 07d2f9a + bd0db0f commit e825079

23 files changed

+75
-48
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
os: [ubuntu-latest, macos-latest, windows-latest]
13-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
13+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1414
name: build - Python ${{ matrix.python-version }} (${{ matrix.os }})
1515
runs-on: ${{ matrix.os }}
1616

CHANGELOG.md

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

3+
## 0.43.0 - 2024-10-09
4+
5+
This release drops support for Python 3.8 which has reached end-of-life.
6+
7+
#### Enhancements
8+
- Added `PriceType` enum for validation of `price_type` parameter in `DBNStore.to_df`
9+
- Upgraded `databento-dbn` to 0.22.1
10+
11+
#### Bug fixes
12+
- Fixed return type hint for `metadata.get_dataset_condition`
13+
14+
#### Breaking changes
15+
- Removed support for Python 3.8 due to end of life
16+
317
## 0.42.0 - 2024-09-23
418

519
#### Enhancements

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# databento-python
22

33
[![test](https://github.com/databento/databento-python/actions/workflows/test.yml/badge.svg?branch=dev)](https://github.com/databento/databento-python/actions/workflows/test.yml)
4-
![python](https://img.shields.io/badge/python-3.8+-blue.svg)
4+
![python](https://img.shields.io/badge/python-3.9+-blue.svg)
55
[![pypi-version](https://img.shields.io/pypi/v/databento)](https://pypi.org/project/databento)
66
[![license](https://img.shields.io/github/license/databento/databento-python?color=blue)](./LICENSE)
77
[![code-style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
@@ -28,16 +28,16 @@ You can find our full client API reference on the [Historical Reference](https:/
2828
[Examples](https://databento.com/docs/examples?historical=python&live=python) section for various tutorials and code samples.
2929

3030
## Requirements
31-
The library is fully compatible with the latest distribution of Anaconda 3.8 and above.
31+
The library is fully compatible with the latest distribution of Anaconda 3.9 and above.
3232
The minimum dependencies as found in the `pyproject.toml` are also listed below:
33-
- python = "^3.8"
33+
- python = "^3.9"
3434
- aiohttp = "^3.8.3"
35-
- databento-dbn = "0.20.1"
35+
- databento-dbn = "0.22.1"
3636
- numpy= ">=1.23.5"
3737
- pandas = ">=1.5.3"
3838
- pip-system-certs = ">=4.0" (Windows only)
3939
- pyarrow = ">=13.0.0"
40-
- requests = ">=2.24.0"
40+
- requests = ">=2.25.1"
4141
- zstandard = ">=0.21.0"
4242

4343
## Installation

databento/common/constants.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
from __future__ import annotations
2-
31
from typing import Final
42

53
import numpy as np
64
from databento_dbn import BBOMsg
75
from databento_dbn import CBBOMsg
6+
from databento_dbn import CMBP1Msg
87
from databento_dbn import ImbalanceMsg
98
from databento_dbn import InstrumentDefMsg
109
from databento_dbn import InstrumentDefMsgV1
@@ -44,7 +43,7 @@
4443
Schema.STATUS: StatusMsg,
4544
Schema.TBBO: MBP1Msg,
4645
Schema.TRADES: TradeMsg,
47-
Schema.CBBO: CBBOMsg,
46+
Schema.CMBP_1: CMBP1Msg,
4847
Schema.CBBO_1S: CBBOMsg,
4948
Schema.CBBO_1M: CBBOMsg,
5049
Schema.TCBBO: CBBOMsg,
@@ -66,7 +65,7 @@
6665
Schema.STATUS: StatusMsg,
6766
Schema.TBBO: MBP1Msg,
6867
Schema.TRADES: TradeMsg,
69-
Schema.CBBO: CBBOMsg,
68+
Schema.CMBP_1: CMBP1Msg,
7069
Schema.CBBO_1S: CBBOMsg,
7170
Schema.CBBO_1M: CBBOMsg,
7271
Schema.TCBBO: CBBOMsg,

databento/common/dbnstore.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from databento.common.constants import DEFINITION_TYPE_MAX_MAP
4848
from databento.common.constants import SCHEMA_STRUCT_MAP
4949
from databento.common.constants import SCHEMA_STRUCT_MAP_V1
50+
from databento.common.enums import PriceType
5051
from databento.common.error import BentoError
5152
from databento.common.error import BentoWarning
5253
from databento.common.symbology import InstrumentMap
@@ -848,7 +849,7 @@ def to_csv(
848849
@overload
849850
def to_df(
850851
self,
851-
price_type: Literal["fixed", "float", "decimal"] = ...,
852+
price_type: PriceType | str = ...,
852853
pretty_ts: bool = ...,
853854
map_symbols: bool = ...,
854855
schema: Schema | str | None = ...,
@@ -859,7 +860,7 @@ def to_df(
859860
@overload
860861
def to_df(
861862
self,
862-
price_type: Literal["fixed", "float", "decimal"] = ...,
863+
price_type: PriceType | str = ...,
863864
pretty_ts: bool = ...,
864865
map_symbols: bool = ...,
865866
schema: Schema | str | None = ...,
@@ -869,7 +870,7 @@ def to_df(
869870

870871
def to_df(
871872
self,
872-
price_type: Literal["fixed", "float", "decimal"] = "float",
873+
price_type: PriceType | str = PriceType.FLOAT,
873874
pretty_ts: bool = True,
874875
map_symbols: bool = True,
875876
schema: Schema | str | None = None,
@@ -883,7 +884,7 @@ def to_df(
883884
884885
Parameters
885886
----------
886-
price_type : str, default "float"
887+
price_type : PriceType or str, default "float"
887888
The price type to use for price fields.
888889
If "fixed", prices will have a type of `int` in fixed decimal format; each unit representing 1e-9 or 0.000000001.
889890
If "float", prices will have a type of `float`.
@@ -918,6 +919,7 @@ def to_df(
918919
If the DBN schema is unspecified and cannot be determined.
919920
920921
"""
922+
price_type = validate_enum(price_type, PriceType, "price_type")
921923
schema = validate_maybe_enum(schema, Schema, "schema")
922924

923925
if isinstance(tz, Default):
@@ -1422,7 +1424,7 @@ def __init__(
14221424
struct_type: type[DBNRecord],
14231425
instrument_map: InstrumentMap,
14241426
tz: pytz.BaseTzInfo,
1425-
price_type: Literal["fixed", "float", "decimal"] = "float",
1427+
price_type: PriceType = PriceType.FLOAT,
14261428
pretty_ts: bool = True,
14271429
map_symbols: bool = True,
14281430
):
@@ -1499,16 +1501,16 @@ def _format_timezone(self, df: pd.DataFrame) -> None:
14991501
def _format_px(
15001502
self,
15011503
df: pd.DataFrame,
1502-
price_type: Literal["fixed", "float", "decimal"],
1504+
price_type: PriceType,
15031505
) -> None:
15041506
px_fields = self._struct_type._price_fields
15051507

1506-
if price_type == "decimal":
1508+
if price_type == PriceType.DECIMAL:
15071509
df[px_fields] = (
15081510
df[px_fields].replace(UNDEF_PRICE, np.nan).applymap(decimal.Decimal)
15091511
/ FIXED_PRICE_SCALE
15101512
)
1511-
elif price_type == "float":
1513+
elif price_type == PriceType.FLOAT:
15121514
df[px_fields] = df[px_fields].replace(UNDEF_PRICE, np.nan) / FIXED_PRICE_SCALE
15131515
else:
15141516
return # do nothing

databento/common/enums.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,21 @@ class RecordFlags(StringyMixin, IntFlag): # type: ignore
225225
@unique
226226
@coercible
227227
class ReconnectPolicy(StringyMixin, str, Enum):
228+
"""
229+
Live session reconnection policy.
230+
"""
231+
228232
NONE = "none"
229233
RECONNECT = "reconnect"
234+
235+
236+
@unique
237+
@coercible
238+
class PriceType(StringyMixin, str, Enum):
239+
"""
240+
Price type for DataFrame price fields.
241+
"""
242+
243+
FIXED = "fixed"
244+
FLOAT = "float"
245+
DECIMAL = "decimal"

databento/common/iterator.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
import itertools
42
from collections.abc import Iterable
53
from typing import TypeVar

databento/common/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
DBNRecord = Union[
1313
databento_dbn.BBOMsg,
1414
databento_dbn.CBBOMsg,
15+
databento_dbn.CMBP1Msg,
1516
databento_dbn.MBOMsg,
1617
databento_dbn.MBP1Msg,
1718
databento_dbn.MBP10Msg,

databento/historical/api/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def get_dataset_condition(
188188
dataset: Dataset | str,
189189
start_date: date | str | None = None,
190190
end_date: date | str | None = None,
191-
) -> dict[str, Any]:
191+
) -> list[dict[str, str]]:
192192
"""
193193
Get the per date dataset conditions from Databento.
194194
@@ -209,7 +209,7 @@ def get_dataset_condition(
209209
210210
Returns
211211
-------
212-
dict[str, Any]
212+
list[dict[str, str]]
213213
214214
"""
215215
params: list[tuple[str, str | None]] = [

notebooks/quickstart.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2236,7 +2236,7 @@
22362236
"name": "python",
22372237
"nbconvert_exporter": "python",
22382238
"pygments_lexer": "ipython3",
2239-
"version": "3.8.17"
2239+
"version": "3.9.16"
22402240
}
22412241
},
22422242
"nbformat": 4,

0 commit comments

Comments
 (0)