Skip to content

Commit

Permalink
ADD: DBN updates to support XNAS.BASIC
Browse files Browse the repository at this point in the history
  • Loading branch information
renan-databento committed Sep 19, 2024
1 parent f80864b commit 75d0f75
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Added `mode` parameter to `DBNStore.to_json` to control the file writing mode
- Added `mode` parameter to `DBNStore.to_parquet` to control the file writing mode
- Added `compression` parameter to `DBNStore.to_file` which controls the output compression format
- Added new consolidated publisher values for `XNAS.BASIC` and `DBEQ.MAX`

#### Breaking changes
- Changed default write mode for `DBNStore.to_csv` to overwrite ("w")
Expand Down
26 changes: 26 additions & 0 deletions databento/common/publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,10 @@ class Publisher(StringyMixin, str, Enum):
NYSE National BBO and Trades.
XNYS_BBOTRADES_XNYS
NYSE BBO and Trades.
XNAS_BASIC_DBEQ
Nasdaq Basic - Consolidated.
DBEQ_MAX_DBEQ
DBEQ Max - Consolidated.
"""

Expand Down Expand Up @@ -1050,6 +1054,8 @@ class Publisher(StringyMixin, str, Enum):
DBEQ_SUMMARY_DBEQ = "DBEQ.SUMMARY.DBEQ"
XCIS_BBOTRADES_XCIS = "XCIS.BBOTRADES.XCIS"
XNYS_BBOTRADES_XNYS = "XNYS.BBOTRADES.XNYS"
XNAS_BASIC_DBEQ = "XNAS.BASIC.DBEQ"
DBEQ_MAX_DBEQ = "DBEQ.MAX.DBEQ"

@classmethod
def from_int(cls, value: int) -> Publisher:
Expand Down Expand Up @@ -1240,6 +1246,10 @@ def from_int(cls, value: int) -> Publisher:
return Publisher.XCIS_BBOTRADES_XCIS
if value == 92:
return Publisher.XNYS_BBOTRADES_XNYS
if value == 93:
return Publisher.XNAS_BASIC_DBEQ
if value == 94:
return Publisher.DBEQ_MAX_DBEQ
raise ValueError(f"Integer value {value} does not correspond with any Publisher variant")

def to_int(self) -> int:
Expand Down Expand Up @@ -1430,6 +1440,10 @@ def to_int(self) -> int:
return 91
if self == Publisher.XNYS_BBOTRADES_XNYS:
return 92
if self == Publisher.XNAS_BASIC_DBEQ:
return 93
if self == Publisher.DBEQ_MAX_DBEQ:
return 94
raise ValueError("Invalid Publisher")

@property
Expand Down Expand Up @@ -1621,6 +1635,10 @@ def venue(self) -> Venue:
return Venue.XCIS
if self == Publisher.XNYS_BBOTRADES_XNYS:
return Venue.XNYS
if self == Publisher.XNAS_BASIC_DBEQ:
return Venue.DBEQ
if self == Publisher.DBEQ_MAX_DBEQ:
return Venue.DBEQ
raise ValueError("Unexpected Publisher value")

@property
Expand Down Expand Up @@ -1812,6 +1830,10 @@ def dataset(self) -> Dataset:
return Dataset.XCIS_BBOTRADES
if self == Publisher.XNYS_BBOTRADES_XNYS:
return Dataset.XNYS_BBOTRADES
if self == Publisher.XNAS_BASIC_DBEQ:
return Dataset.XNAS_BASIC
if self == Publisher.DBEQ_MAX_DBEQ:
return Dataset.DBEQ_MAX
raise ValueError("Unexpected Publisher value")

@property
Expand Down Expand Up @@ -2003,4 +2025,8 @@ def description(self) -> str:
return "NYSE National BBO and Trades"
if self == Publisher.XNYS_BBOTRADES_XNYS:
return "NYSE BBO and Trades"
if self == Publisher.XNAS_BASIC_DBEQ:
return "Nasdaq Basic - Consolidated"
if self == Publisher.DBEQ_MAX_DBEQ:
return "DBEQ Max - Consolidated"
raise ValueError("Unexpected Publisher value")

0 comments on commit 75d0f75

Please sign in to comment.