Skip to content

Commit cab2937

Browse files
authored
VER: Release 0.30.0 (#50)
2 parents b8a1227 + 0d5adde commit cab2937

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+409
-100
lines changed

CHANGELOG.md

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

3+
## 0.30.0 - 2024-02-22
4+
5+
#### Enhancements
6+
- Changed how `SymbolMappingMsg` objects are ingested by `InstrumentMap` to single source the timestamp parsing from the `databento-dbn` package
7+
8+
#### Bug fixes
9+
- Fixed an issue where setting a timezone in `DBNStore.to_df` could cause invalid symbol mappings
10+
11+
#### Breaking changes
12+
- Changed `Live.add_stream` to use the exclusive write mode when handling file paths so existing files won't be overwritten
13+
314
## 0.29.0 - 2024-02-13
415

516
#### Enhancements
617
- Added `tz` parameter to `DBNStore.to_df` which will convert all timestamp fields from UTC to a specified timezone when used with `pretty_ts`
18+
- Added new publisher values for consolidated DBEQ.MAX
719

820
#### Bug fixes
921
- `Live.block_for_close` and `Live.wait_for_close` will now call `Live.stop` when a timeout is reached instead of `Live.terminate` to close the stream more gracefully

databento/common/dbnstore.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,16 +1378,19 @@ def __next__(self) -> pd.DataFrame:
13781378

13791379
self._format_hidden_fields(df)
13801380

1381-
self._format_px(df, self._price_type)
1382-
13831381
if self._pretty_ts:
13841382
self._format_pretty_ts(df)
13851383

1386-
self._format_set_index(df)
1387-
13881384
if self._map_symbols:
13891385
self._format_map_symbols(df)
13901386

1387+
if self._pretty_ts:
1388+
self._format_timezone(df)
1389+
1390+
self._format_px(df, self._price_type)
1391+
1392+
self._format_set_index(df)
1393+
13911394
return df
13921395

13931396
def _format_definition_fields(self, df: pd.DataFrame) -> None:
@@ -1402,13 +1405,20 @@ def _format_hidden_fields(self, df: pd.DataFrame) -> None:
14021405
df[column] = df[column].str.decode("utf-8")
14031406

14041407
def _format_map_symbols(self, df: pd.DataFrame) -> None:
1405-
df_index = df.index if self._pretty_ts else pd.to_datetime(df.index, utc=True)
1408+
# the first ordered field will be ts_recv or ts_event when appropriate
1409+
ts_name = self._struct_type._ordered_fields[0]
1410+
1411+
df_index = df[ts_name] if self._pretty_ts else pd.to_datetime(df[ts_name], utc=True)
14061412
dates = [ts.date() for ts in df_index]
14071413
df["symbol"] = [
14081414
self._instrument_map.resolve(inst, dates[i])
14091415
for i, inst in enumerate(df["instrument_id"])
14101416
]
14111417

1418+
def _format_timezone(self, df: pd.DataFrame) -> None:
1419+
for field in self._struct_type._timestamp_fields:
1420+
df[field] = df[field].dt.tz_convert(self._tz)
1421+
14121422
def _format_px(
14131423
self,
14141424
df: pd.DataFrame,
@@ -1429,8 +1439,9 @@ def _format_px(
14291439

14301440
def _format_pretty_ts(self, df: pd.DataFrame) -> None:
14311441
for field in self._struct_type._timestamp_fields:
1432-
df[field] = pd.to_datetime(df[field], utc=True, errors="coerce").dt.tz_convert(self._tz)
1442+
df[field] = pd.to_datetime(df[field], utc=True, errors="coerce")
14331443

14341444
def _format_set_index(self, df: pd.DataFrame) -> None:
1445+
# the first ordered field will be ts_recv or ts_event when appropriate
14351446
index_column = self._struct_type._ordered_fields[0]
14361447
df.set_index(index_column, inplace=True)

0 commit comments

Comments
 (0)