Skip to content

Commit 2479d10

Browse files
authored
VER: Release 0.23.0
See release notes.
2 parents f4e2a13 + 75e158e commit 2479d10

18 files changed

+478
-23
lines changed

CHANGELOG.md

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

3+
## 0.23.0 - 2023-10-26
4+
5+
#### Enhancements
6+
- Added `map_symbols_csv` function to the `databento` module for using `symbology.json` files to map a symbol column onto a CSV file
7+
- 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
8+
- Added new publisher values in preparation for IFEU.IMPACT and NDEX.IMPACT datasets
9+
10+
#### Bug fixes
11+
- Fixed issue where a large unreadable symbol subscription message could be sent
12+
- Fixed an issue where `DBNStore.to_df` with `pretty_ts=True` was very slow
13+
314
## 0.22.1 - 2023-10-24
415

516
#### Bug fixes

databento/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from databento_dbn import TradeMsg
2020

2121
from databento.common import bentologging
22+
from databento.common import symbology
2223
from databento.common.dbnstore import DBNStore
2324
from databento.common.enums import Delivery
2425
from databento.common.enums import FeedMode
@@ -35,6 +36,7 @@
3536
from databento.common.publishers import Dataset
3637
from databento.common.publishers import Publisher
3738
from databento.common.publishers import Venue
39+
from databento.common.symbology import InstrumentMap
3840
from databento.historical.api import API_VERSION
3941
from databento.historical.client import Historical
4042
from databento.live import DBNRecord
@@ -60,6 +62,7 @@
6062
"RecordFlags",
6163
"Historical",
6264
"HistoricalGateway",
65+
"InstrumentMap",
6366
"Live",
6467
"Packaging",
6568
"RollRule",
@@ -91,3 +94,5 @@
9194
# Convenience imports
9295
enable_logging = bentologging.enable_logging
9396
from_dbn = DBNStore.from_file
97+
map_symbols_csv = symbology.map_symbols_csv
98+
map_symbols_json = symbology.map_symbols_json

databento/common/bentologging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
def enable_logging(level: int | str = logging.INFO) -> None:
77
"""
88
Enable logging for the Databento module. This function should be used for
9-
simple applications and examples. It is advisible to configure your own
9+
simple applications and examples. It is advisable to configure your own
1010
logging for serious applications.
1111
1212
Parameters

databento/common/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALL_SYMBOLS = "ALL_SYMBOLS"

databento/common/dbnstore.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import warnings
88
from collections.abc import Generator
99
from collections.abc import Iterator
10-
from functools import partial
1110
from io import BytesIO
1211
from os import PathLike
1312
from pathlib import Path
@@ -1112,8 +1111,8 @@ def _transcode(
11121111
compression=compression,
11131112
pretty_px=pretty_px,
11141113
pretty_ts=pretty_ts,
1115-
map_symbols=map_symbols,
11161114
has_metadata=True,
1115+
map_symbols=map_symbols,
11171116
symbol_map=symbol_map, # type: ignore [arg-type]
11181117
schema=schema,
11191118
)
@@ -1246,9 +1245,7 @@ def _format_px(
12461245

12471246
def _format_pretty_ts(self, df: pd.DataFrame) -> None:
12481247
for field in self._struct._timestamp_fields:
1249-
df[field] = df[field].apply(
1250-
partial(pd.to_datetime, utc=True, errors="coerce"),
1251-
)
1248+
df[field] = pd.to_datetime(df[field], utc=True, errors="coerce")
12521249

12531250
def _format_set_index(self, df: pd.DataFrame) -> None:
12541251
index_column = (

databento/common/parsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pandas as pd
1010
from databento_dbn import SType
1111

12-
from databento.common.symbology import ALL_SYMBOLS
12+
from databento.common.constants import ALL_SYMBOLS
1313
from databento.common.validation import validate_smart_symbol
1414

1515

databento/common/publishers.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ class Venue(StringyMixin, str, Enum):
9191
Cboe BZX Options Exchange.
9292
MXOP
9393
MEMX LLC Options.
94+
IFEU
95+
ICE Futures Europe (Commodities).
96+
NDEX
97+
ICE Endex.
9498
9599
"""
96100

@@ -131,6 +135,8 @@ class Venue(StringyMixin, str, Enum):
131135
XPHL = "XPHL"
132136
BATO = "BATO"
133137
MXOP = "MXOP"
138+
IFEU = "IFEU"
139+
NDEX = "NDEX"
134140

135141
@classmethod
136142
def from_int(cls, value: int) -> Venue:
@@ -211,6 +217,10 @@ def from_int(cls, value: int) -> Venue:
211217
return Venue.BATO
212218
if value == 37:
213219
return Venue.MXOP
220+
if value == 38:
221+
return Venue.IFEU
222+
if value == 39:
223+
return Venue.NDEX
214224
raise ValueError(f"Integer value {value} does not correspond with any Venue variant")
215225

216226
def to_int(self) -> int:
@@ -291,6 +301,10 @@ def to_int(self) -> int:
291301
return 36
292302
if self == Venue.MXOP:
293303
return 37
304+
if self == Venue.IFEU:
305+
return 38
306+
if self == Venue.NDEX:
307+
return 39
294308
raise ValueError("Invalid Venue")
295309

296310
@property
@@ -372,6 +386,10 @@ def description(self) -> str:
372386
return "Cboe BZX Options Exchange"
373387
if self == Venue.MXOP:
374388
return "MEMX LLC Options"
389+
if self == Venue.IFEU:
390+
return "ICE Futures Europe (Commodities)"
391+
if self == Venue.NDEX:
392+
return "ICE Endex"
375393
raise ValueError("Unexpected Venue value")
376394

377395
@unique
@@ -434,6 +452,10 @@ class Dataset(StringyMixin, str, Enum):
434452
Nasdaq QBBO.
435453
XNAS_NLS
436454
Nasdaq NLS.
455+
IFEU_IMPACT
456+
ICE Futures Europe (Commodities) iMpact.
457+
NDEX_IMPACT
458+
ICE Endex iMpact.
437459
438460
"""
439461

@@ -464,6 +486,8 @@ class Dataset(StringyMixin, str, Enum):
464486
XNYS_TRADES = "XNYS.TRADES"
465487
XNAS_QBBO = "XNAS.QBBO"
466488
XNAS_NLS = "XNAS.NLS"
489+
IFEU_IMPACT = "IFEU.IMPACT"
490+
NDEX_IMPACT = "NDEX.IMPACT"
467491

468492
@classmethod
469493
def from_int(cls, value: int) -> Dataset:
@@ -524,6 +548,10 @@ def from_int(cls, value: int) -> Dataset:
524548
return Dataset.XNAS_QBBO
525549
if value == 27:
526550
return Dataset.XNAS_NLS
551+
if value == 28:
552+
return Dataset.IFEU_IMPACT
553+
if value == 29:
554+
return Dataset.NDEX_IMPACT
527555
raise ValueError(f"Integer value {value} does not correspond with any Dataset variant")
528556

529557
def to_int(self) -> int:
@@ -584,6 +612,10 @@ def to_int(self) -> int:
584612
return 26
585613
if self == Dataset.XNAS_NLS:
586614
return 27
615+
if self == Dataset.IFEU_IMPACT:
616+
return 28
617+
if self == Dataset.NDEX_IMPACT:
618+
return 29
587619
raise ValueError("Invalid Dataset")
588620

589621
@property
@@ -645,6 +677,10 @@ def description(self) -> str:
645677
return "Nasdaq QBBO"
646678
if self == Dataset.XNAS_NLS:
647679
return "Nasdaq NLS"
680+
if self == Dataset.IFEU_IMPACT:
681+
return "ICE Futures Europe (Commodities) iMpact"
682+
if self == Dataset.NDEX_IMPACT:
683+
return "ICE Endex iMpact"
648684
raise ValueError("Unexpected Dataset value")
649685

650686
@unique
@@ -765,6 +801,10 @@ class Publisher(StringyMixin, str, Enum):
765801
DBEQ Plus - FINRA/Nasdaq TRF Carteret.
766802
DBEQ_PLUS_FINC
767803
DBEQ Plus - FINRA/Nasdaq TRF Chicago.
804+
IFEU_IMPACT_IFEU
805+
ICE Futures Europe (Commodities).
806+
NDEX_IMPACT_NDEX
807+
ICE Endex.
768808
769809
"""
770810

@@ -824,6 +864,8 @@ class Publisher(StringyMixin, str, Enum):
824864
DBEQ_PLUS_FINN = "DBEQ.PLUS.FINN"
825865
DBEQ_PLUS_FINY = "DBEQ.PLUS.FINY"
826866
DBEQ_PLUS_FINC = "DBEQ.PLUS.FINC"
867+
IFEU_IMPACT_IFEU = "IFEU.IMPACT.IFEU"
868+
NDEX_IMPACT_NDEX = "NDEX.IMPACT.NDEX"
827869

828870
@classmethod
829871
def from_int(cls, value: int) -> Publisher:
@@ -942,6 +984,10 @@ def from_int(cls, value: int) -> Publisher:
942984
return Publisher.DBEQ_PLUS_FINY
943985
if value == 56:
944986
return Publisher.DBEQ_PLUS_FINC
987+
if value == 57:
988+
return Publisher.IFEU_IMPACT_IFEU
989+
if value == 58:
990+
return Publisher.NDEX_IMPACT_NDEX
945991
raise ValueError(f"Integer value {value} does not correspond with any Publisher variant")
946992

947993
def to_int(self) -> int:
@@ -1060,6 +1106,10 @@ def to_int(self) -> int:
10601106
return 55
10611107
if self == Publisher.DBEQ_PLUS_FINC:
10621108
return 56
1109+
if self == Publisher.IFEU_IMPACT_IFEU:
1110+
return 57
1111+
if self == Publisher.NDEX_IMPACT_NDEX:
1112+
return 58
10631113
raise ValueError("Invalid Publisher")
10641114
@property
10651115
def venue(self) -> Venue:
@@ -1178,6 +1228,10 @@ def venue(self) -> Venue:
11781228
return Venue.FINY
11791229
if self == Publisher.DBEQ_PLUS_FINC:
11801230
return Venue.FINC
1231+
if self == Publisher.IFEU_IMPACT_IFEU:
1232+
return Venue.IFEU
1233+
if self == Publisher.NDEX_IMPACT_NDEX:
1234+
return Venue.NDEX
11811235
raise ValueError("Unexpected Publisher value")
11821236
@property
11831237
def dataset(self) -> Dataset:
@@ -1296,6 +1350,10 @@ def dataset(self) -> Dataset:
12961350
return Dataset.DBEQ_PLUS
12971351
if self == Publisher.DBEQ_PLUS_FINC:
12981352
return Dataset.DBEQ_PLUS
1353+
if self == Publisher.IFEU_IMPACT_IFEU:
1354+
return Dataset.IFEU_IMPACT
1355+
if self == Publisher.NDEX_IMPACT_NDEX:
1356+
return Dataset.NDEX_IMPACT
12991357
raise ValueError("Unexpected Publisher value")
13001358

13011359
@property
@@ -1415,4 +1473,8 @@ def description(self) -> str:
14151473
return "DBEQ Plus - FINRA/Nasdaq TRF Carteret"
14161474
if self == Publisher.DBEQ_PLUS_FINC:
14171475
return "DBEQ Plus - FINRA/Nasdaq TRF Chicago"
1476+
if self == Publisher.IFEU_IMPACT_IFEU:
1477+
return "ICE Futures Europe (Commodities)"
1478+
if self == Publisher.NDEX_IMPACT_NDEX:
1479+
return "ICE Endex"
14181480
raise ValueError("Unexpected Publisher value")

0 commit comments

Comments
 (0)