Skip to content

Commit

Permalink
VER: Release 0.23.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
nmacholl authored Oct 26, 2023
2 parents f4e2a13 + 75e158e commit 2479d10
Show file tree
Hide file tree
Showing 18 changed files with 478 additions and 23 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.23.0 - 2023-10-26

#### Enhancements
- Added `map_symbols_csv` function to the `databento` module for using `symbology.json` files to map a symbol column onto a CSV file
- Added `map_symbols_json` function to the `databento` module for using `symbology.json` files to add a symbol key to a file of JSON records
- Added new publisher values in preparation for IFEU.IMPACT and NDEX.IMPACT datasets

#### Bug fixes
- Fixed issue where a large unreadable symbol subscription message could be sent
- Fixed an issue where `DBNStore.to_df` with `pretty_ts=True` was very slow

## 0.22.1 - 2023-10-24

#### Bug fixes
Expand Down
5 changes: 5 additions & 0 deletions databento/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from databento_dbn import TradeMsg

from databento.common import bentologging
from databento.common import symbology
from databento.common.dbnstore import DBNStore
from databento.common.enums import Delivery
from databento.common.enums import FeedMode
Expand All @@ -35,6 +36,7 @@
from databento.common.publishers import Dataset
from databento.common.publishers import Publisher
from databento.common.publishers import Venue
from databento.common.symbology import InstrumentMap
from databento.historical.api import API_VERSION
from databento.historical.client import Historical
from databento.live import DBNRecord
Expand All @@ -60,6 +62,7 @@
"RecordFlags",
"Historical",
"HistoricalGateway",
"InstrumentMap",
"Live",
"Packaging",
"RollRule",
Expand Down Expand Up @@ -91,3 +94,5 @@
# Convenience imports
enable_logging = bentologging.enable_logging
from_dbn = DBNStore.from_file
map_symbols_csv = symbology.map_symbols_csv
map_symbols_json = symbology.map_symbols_json
2 changes: 1 addition & 1 deletion databento/common/bentologging.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def enable_logging(level: int | str = logging.INFO) -> None:
"""
Enable logging for the Databento module. This function should be used for
simple applications and examples. It is advisible to configure your own
simple applications and examples. It is advisable to configure your own
logging for serious applications.
Parameters
Expand Down
1 change: 1 addition & 0 deletions databento/common/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALL_SYMBOLS = "ALL_SYMBOLS"
7 changes: 2 additions & 5 deletions databento/common/dbnstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import warnings
from collections.abc import Generator
from collections.abc import Iterator
from functools import partial
from io import BytesIO
from os import PathLike
from pathlib import Path
Expand Down Expand Up @@ -1112,8 +1111,8 @@ def _transcode(
compression=compression,
pretty_px=pretty_px,
pretty_ts=pretty_ts,
map_symbols=map_symbols,
has_metadata=True,
map_symbols=map_symbols,
symbol_map=symbol_map, # type: ignore [arg-type]
schema=schema,
)
Expand Down Expand Up @@ -1246,9 +1245,7 @@ def _format_px(

def _format_pretty_ts(self, df: pd.DataFrame) -> None:
for field in self._struct._timestamp_fields:
df[field] = df[field].apply(
partial(pd.to_datetime, utc=True, errors="coerce"),
)
df[field] = pd.to_datetime(df[field], utc=True, errors="coerce")

def _format_set_index(self, df: pd.DataFrame) -> None:
index_column = (
Expand Down
2 changes: 1 addition & 1 deletion databento/common/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pandas as pd
from databento_dbn import SType

from databento.common.symbology import ALL_SYMBOLS
from databento.common.constants import ALL_SYMBOLS
from databento.common.validation import validate_smart_symbol


Expand Down
62 changes: 62 additions & 0 deletions databento/common/publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class Venue(StringyMixin, str, Enum):
Cboe BZX Options Exchange.
MXOP
MEMX LLC Options.
IFEU
ICE Futures Europe (Commodities).
NDEX
ICE Endex.
"""

Expand Down Expand Up @@ -131,6 +135,8 @@ class Venue(StringyMixin, str, Enum):
XPHL = "XPHL"
BATO = "BATO"
MXOP = "MXOP"
IFEU = "IFEU"
NDEX = "NDEX"

@classmethod
def from_int(cls, value: int) -> Venue:
Expand Down Expand Up @@ -211,6 +217,10 @@ def from_int(cls, value: int) -> Venue:
return Venue.BATO
if value == 37:
return Venue.MXOP
if value == 38:
return Venue.IFEU
if value == 39:
return Venue.NDEX
raise ValueError(f"Integer value {value} does not correspond with any Venue variant")

def to_int(self) -> int:
Expand Down Expand Up @@ -291,6 +301,10 @@ def to_int(self) -> int:
return 36
if self == Venue.MXOP:
return 37
if self == Venue.IFEU:
return 38
if self == Venue.NDEX:
return 39
raise ValueError("Invalid Venue")

@property
Expand Down Expand Up @@ -372,6 +386,10 @@ def description(self) -> str:
return "Cboe BZX Options Exchange"
if self == Venue.MXOP:
return "MEMX LLC Options"
if self == Venue.IFEU:
return "ICE Futures Europe (Commodities)"
if self == Venue.NDEX:
return "ICE Endex"
raise ValueError("Unexpected Venue value")

@unique
Expand Down Expand Up @@ -434,6 +452,10 @@ class Dataset(StringyMixin, str, Enum):
Nasdaq QBBO.
XNAS_NLS
Nasdaq NLS.
IFEU_IMPACT
ICE Futures Europe (Commodities) iMpact.
NDEX_IMPACT
ICE Endex iMpact.
"""

Expand Down Expand Up @@ -464,6 +486,8 @@ class Dataset(StringyMixin, str, Enum):
XNYS_TRADES = "XNYS.TRADES"
XNAS_QBBO = "XNAS.QBBO"
XNAS_NLS = "XNAS.NLS"
IFEU_IMPACT = "IFEU.IMPACT"
NDEX_IMPACT = "NDEX.IMPACT"

@classmethod
def from_int(cls, value: int) -> Dataset:
Expand Down Expand Up @@ -524,6 +548,10 @@ def from_int(cls, value: int) -> Dataset:
return Dataset.XNAS_QBBO
if value == 27:
return Dataset.XNAS_NLS
if value == 28:
return Dataset.IFEU_IMPACT
if value == 29:
return Dataset.NDEX_IMPACT
raise ValueError(f"Integer value {value} does not correspond with any Dataset variant")

def to_int(self) -> int:
Expand Down Expand Up @@ -584,6 +612,10 @@ def to_int(self) -> int:
return 26
if self == Dataset.XNAS_NLS:
return 27
if self == Dataset.IFEU_IMPACT:
return 28
if self == Dataset.NDEX_IMPACT:
return 29
raise ValueError("Invalid Dataset")

@property
Expand Down Expand Up @@ -645,6 +677,10 @@ def description(self) -> str:
return "Nasdaq QBBO"
if self == Dataset.XNAS_NLS:
return "Nasdaq NLS"
if self == Dataset.IFEU_IMPACT:
return "ICE Futures Europe (Commodities) iMpact"
if self == Dataset.NDEX_IMPACT:
return "ICE Endex iMpact"
raise ValueError("Unexpected Dataset value")

@unique
Expand Down Expand Up @@ -765,6 +801,10 @@ class Publisher(StringyMixin, str, Enum):
DBEQ Plus - FINRA/Nasdaq TRF Carteret.
DBEQ_PLUS_FINC
DBEQ Plus - FINRA/Nasdaq TRF Chicago.
IFEU_IMPACT_IFEU
ICE Futures Europe (Commodities).
NDEX_IMPACT_NDEX
ICE Endex.
"""

Expand Down Expand Up @@ -824,6 +864,8 @@ class Publisher(StringyMixin, str, Enum):
DBEQ_PLUS_FINN = "DBEQ.PLUS.FINN"
DBEQ_PLUS_FINY = "DBEQ.PLUS.FINY"
DBEQ_PLUS_FINC = "DBEQ.PLUS.FINC"
IFEU_IMPACT_IFEU = "IFEU.IMPACT.IFEU"
NDEX_IMPACT_NDEX = "NDEX.IMPACT.NDEX"

@classmethod
def from_int(cls, value: int) -> Publisher:
Expand Down Expand Up @@ -942,6 +984,10 @@ def from_int(cls, value: int) -> Publisher:
return Publisher.DBEQ_PLUS_FINY
if value == 56:
return Publisher.DBEQ_PLUS_FINC
if value == 57:
return Publisher.IFEU_IMPACT_IFEU
if value == 58:
return Publisher.NDEX_IMPACT_NDEX
raise ValueError(f"Integer value {value} does not correspond with any Publisher variant")

def to_int(self) -> int:
Expand Down Expand Up @@ -1060,6 +1106,10 @@ def to_int(self) -> int:
return 55
if self == Publisher.DBEQ_PLUS_FINC:
return 56
if self == Publisher.IFEU_IMPACT_IFEU:
return 57
if self == Publisher.NDEX_IMPACT_NDEX:
return 58
raise ValueError("Invalid Publisher")
@property
def venue(self) -> Venue:
Expand Down Expand Up @@ -1178,6 +1228,10 @@ def venue(self) -> Venue:
return Venue.FINY
if self == Publisher.DBEQ_PLUS_FINC:
return Venue.FINC
if self == Publisher.IFEU_IMPACT_IFEU:
return Venue.IFEU
if self == Publisher.NDEX_IMPACT_NDEX:
return Venue.NDEX
raise ValueError("Unexpected Publisher value")
@property
def dataset(self) -> Dataset:
Expand Down Expand Up @@ -1296,6 +1350,10 @@ def dataset(self) -> Dataset:
return Dataset.DBEQ_PLUS
if self == Publisher.DBEQ_PLUS_FINC:
return Dataset.DBEQ_PLUS
if self == Publisher.IFEU_IMPACT_IFEU:
return Dataset.IFEU_IMPACT
if self == Publisher.NDEX_IMPACT_NDEX:
return Dataset.NDEX_IMPACT
raise ValueError("Unexpected Publisher value")

@property
Expand Down Expand Up @@ -1415,4 +1473,8 @@ def description(self) -> str:
return "DBEQ Plus - FINRA/Nasdaq TRF Carteret"
if self == Publisher.DBEQ_PLUS_FINC:
return "DBEQ Plus - FINRA/Nasdaq TRF Chicago"
if self == Publisher.IFEU_IMPACT_IFEU:
return "ICE Futures Europe (Commodities)"
if self == Publisher.NDEX_IMPACT_NDEX:
return "ICE Endex"
raise ValueError("Unexpected Publisher value")
Loading

0 comments on commit 2479d10

Please sign in to comment.