Skip to content

Commit d5e540d

Browse files
author
Zach Banks
committed
ADD: Add exchanges param to CA .get_range
1 parent df9dd18 commit d5e540d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Changelog
22

3-
## 0.55.0 - TBD
3+
## TBD
44

55
#### Enhancements
6+
- Added `exchanges` parameter to `Reference.corporate_actions.get_range(...)`
67
- Added `is_last` field to live subscription requests which will be used to improve
78
the handling of split subscription requests
89

databento/reference/api/corporate.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def get_range(
3939
stype_in: SType | str = "raw_symbol",
4040
events: Iterable[str] | str | None = None,
4141
countries: Iterable[str] | str | None = None,
42+
exchanges: Iterable[str] | str | None = None,
4243
security_types: Iterable[str] | str | None = None,
4344
flatten: bool = True,
4445
pit: bool = False,
@@ -84,6 +85,11 @@ def get_range(
8485
Takes any number of two letter ISO 3166-1 alpha-2 country codes per request.
8586
If not specified then will select **all** listing countries by default.
8687
See [CNTRY](https://databento.com/docs/standards-and-conventions/reference-data-enums#cntry) enum.
88+
exchanges : Iterable[str] or str, optional
89+
The (listing) exchanges to filter for.
90+
Takes any number of exchanges per request.
91+
If not specified then will select **all** exchanges by default.
92+
See [EXCHANGE](https://databento.com/docs/standards-and-conventions/reference-data-enums#exchange) enum.
8793
security_types : Iterable[str] or str, optional
8894
The security types to filter for.
8995
Takes any number of security types per request.
@@ -108,6 +114,7 @@ def get_range(
108114
symbols_list = optional_symbols_list_to_list(symbols, SType.RAW_SYMBOL)
109115
events = optional_string_to_list(events)
110116
countries = optional_string_to_list(countries)
117+
exchanges = optional_string_to_list(exchanges)
111118
security_types = optional_string_to_list(security_types)
112119

113120
data: dict[str, object | None] = {
@@ -122,6 +129,10 @@ def get_range(
122129
"compression": str(Compression.ZSTD), # Always request zstd
123130
}
124131

132+
# Only add the `exchanges` param if it is supplied, for compatibility
133+
if exchanges:
134+
data["exchanges"] = ",".join(exchanges)
135+
125136
response = self._post(
126137
url=self._base_url + ".get_range",
127138
data=data,

0 commit comments

Comments
 (0)