Skip to content

Commit 825b42c

Browse files
authored
VER: Release 0.11.0
See release notes.
2 parents 486e405 + f91a262 commit 825b42c

File tree

10 files changed

+85
-54
lines changed

10 files changed

+85
-54
lines changed

CHANGELOG.md

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

3+
## 0.11.0 - 2023-04-13
4+
- Changed `end` and `end_date` to optional to support new forward-fill behaviour
5+
- Upgraded `zstandard` to 0.20.0
6+
37
## 0.10.0 - 2023-04-07
48
- Upgraded `databento-dbn` to 0.4.3
59
- Renamed `Bento` class to `DBNStore`
@@ -23,7 +27,7 @@
2327
- Added `from_dbn` convenience alias for loading DBN files
2428

2529
## 0.8.0 - 2023-03-03
26-
- Integrated DBN encoding `0.3.2`
30+
- Integrated DBN encoding 0.3.2
2731
- Renamed `timeseries.stream` to `timeseries.get_range`
2832
- Renamed `timeseries.stream_async` to `timeseries.get_range_async`
2933
- Deprecated `timeseries.stream(...)` method
@@ -39,20 +43,20 @@
3943
## 0.7.0 - 2023-01-10
4044
- Added support for `definition` schema
4145
- Updated `Flags` enum
42-
- Upgraded `dbz-python` to `0.2.1`
43-
- Upgraded `zstandard` to `0.19.0`
46+
- Upgraded `dbz-python` to 0.2.1
47+
- Upgraded `zstandard` to 0.19.0
4448

4549
## 0.6.0 - 2022-12-02
4650
- Added `metadata.get_dataset_condition` method to `Historical` client
47-
- Upgraded `dbz-python` to `0.2.0`
51+
- Upgraded `dbz-python` to 0.2.0
4852

4953
## 0.5.0 - 2022-11-07
5054
- Fixed dataframe columns for derived data schemas (dropped `channel_id`)
5155
- Fixed `batch.submit_job` requests for `dbz` encoding
5256
- Updated `quickstart.ipynb` jupyter notebook
5357

5458
## 0.4.0 - 2022-09-14
55-
- Upgraded `dbz-python` to `0.1.5`
59+
- Upgraded `dbz-python` to 0.1.5
5660
- Added `map_symbols` option for `.to_df()` (experimental)
5761

5862
## 0.3.0 - 2022-08-30

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The minimum dependencies as found in the `requirements.txt` are also listed belo
3535
- numpy (>=1.17.0)
3636
- pandas (>=1.1.3)
3737
- requests (>=2.24.0)
38-
- zstandard (>=0.19.0)
38+
- zstandard (>=0.20.0)
3939

4040
## Installation
4141
To install the latest stable version of the package from PyPI:

databento/historical/api/batch.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ def __init__(self, key: str, gateway: str) -> None:
5555
def submit_job(
5656
self,
5757
dataset: Union[Dataset, str],
58-
start: Union[pd.Timestamp, date, str, int],
59-
end: Union[pd.Timestamp, date, str, int],
6058
symbols: Optional[Union[List[str], str]],
6159
schema: Union[Schema, str],
60+
start: Union[pd.Timestamp, date, str, int],
61+
end: Optional[Union[pd.Timestamp, date, str, int]] = None,
6262
encoding: Union[Encoding, str] = "dbn",
6363
compression: Optional[Union[Compression, str]] = "zstd",
6464
split_duration: Union[SplitDuration, str] = "day",
@@ -78,20 +78,22 @@ def submit_job(
7878
----------
7979
dataset : Dataset or str
8080
The dataset code (string identifier) for the request.
81+
symbols : List[Union[str, int]] or str
82+
The product symbols to filter for. Takes up to 2,000 symbols per request.
83+
If more than 1 symbol is specified, the data is merged and sorted by time.
84+
If 'ALL_SYMBOLS' or `None` then will be for **all** symbols.
85+
schema : Schema or str {'mbo', 'mbp-1', 'mbp-10', 'trades', 'tbbo', 'ohlcv-1s', 'ohlcv-1m', 'ohlcv-1h', 'ohlcv-1d', 'definition', 'statistics', 'status'}, default 'trades' # noqa
86+
The data record schema for the request.
8187
start : pd.Timestamp or date or str or int
8288
The start datetime of the request time range (inclusive).
8389
Assumes UTC as timezone unless passed a tz-aware object.
8490
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
85-
end : pd.Timestamp or date or str or int
91+
end : pd.Timestamp or date or str or int, optional
8692
The end datetime of the request time range (exclusive).
8793
Assumes UTC as timezone unless passed a tz-aware object.
8894
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
89-
symbols : List[Union[str, int]] or str
90-
The product symbols to filter for. Takes up to 2,000 symbols per request.
91-
If more than 1 symbol is specified, the data is merged and sorted by time.
92-
If 'ALL_SYMBOLS' or `None` then will be for **all** symbols.
93-
schema : Schema or str {'mbo', 'mbp-1', 'mbp-10', 'trades', 'tbbo', 'ohlcv-1s', 'ohlcv-1m', 'ohlcv-1h', 'ohlcv-1d', 'definition', 'statistics', 'status'}, default 'trades' # noqa
94-
The data record schema for the request.
95+
Values are forward filled based on the resolution provided.
96+
Defaults to the same value as `start`.
9597
encoding : Encoding or str {'dbn', 'csv', 'json'}, default 'dbn'
9698
The data encoding.
9799
compression : Compression or str {'none', 'zstd'}, default 'zstd'

databento/historical/api/metadata.py

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def list_unit_prices(
162162
schema: Optional[Union[Schema, str]] = None,
163163
) -> Union[float, Dict[str, Any]]:
164164
"""
165-
List unit prices for each data schema in dollars per gigabyte.
165+
List unit prices for each data schema in US dollars per gigabyte.
166166
167167
Makes a `GET /metadata.list_unit_prices` HTTP request.
168168
@@ -273,7 +273,7 @@ def get_record_count(
273273
self,
274274
dataset: Union[Dataset, str],
275275
start: Union[pd.Timestamp, date, str, int],
276-
end: Union[pd.Timestamp, date, str, int],
276+
end: Optional[Union[pd.Timestamp, date, str, int]] = None,
277277
symbols: Optional[Union[List[str], str]] = None,
278278
schema: Union[Schema, str] = "trades",
279279
stype_in: Optional[Union[SType, str]] = "native",
@@ -289,11 +289,15 @@ def get_record_count(
289289
dataset : Dataset or str
290290
The dataset code for the request.
291291
start : pd.Timestamp or date or str or int
292-
The start datetime for the request range. Assumes UTC as timezone unless otherwise specified.
292+
The start datetime for the request range (inclusive).
293+
Assumes UTC as timezone unless otherwise specified.
293294
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
294-
end : pd.Timestamp or date or str or int
295-
The end datetime for the request range. Assumes UTC as timezone unless otherwise specified.
295+
end : pd.Timestamp or date or str or int, optional
296+
The end datetime for the request range (exclusive).
297+
Assumes UTC as timezone unless otherwise specified.
296298
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
299+
Values are forward filled based on the resolution provided.
300+
Defaults to the same value as `start`.
297301
symbols : List[Union[str, int]] or str, optional
298302
The product symbols to filter for. Takes up to 2,000 symbols per request.
299303
If 'ALL_SYMBOLS' or `None` then will be for **all** symbols.
@@ -337,7 +341,7 @@ def get_billable_size(
337341
self,
338342
dataset: Union[Dataset, str],
339343
start: Union[pd.Timestamp, date, str, int],
340-
end: Union[pd.Timestamp, date, str, int],
344+
end: Optional[Union[pd.Timestamp, date, str, int]] = None,
341345
symbols: Optional[Union[List[str], str]] = None,
342346
schema: Union[Schema, str] = "trades",
343347
stype_in: Optional[Union[SType, str]] = "native",
@@ -353,12 +357,16 @@ def get_billable_size(
353357
----------
354358
dataset : Dataset or str
355359
The dataset code for the request.
356-
start : pd.Timestamp or date or str or int, optional
357-
The start datetime for the request range. Assumes UTC as timezone unless otherwise specified.
360+
start : pd.Timestamp or date or str or int
361+
The start datetime for the request range (inclusive).
362+
Assumes UTC as timezone unless otherwise specified.
358363
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
359364
end : pd.Timestamp or date or str or int, optional
360-
The end datetime for the request range. Assumes UTC as timezone unless otherwise specified.
365+
The end datetime for the request range (exclusive).
366+
Assumes UTC as timezone unless otherwise specified.
361367
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
368+
Values are forward filled based on the resolution provided.
369+
Defaults to the same value as `start`.
362370
symbols : List[Union[str, int]] or str, optional
363371
The product symbols to filter for. Takes up to 2,000 symbols per request.
364372
If 'ALL_SYMBOLS' or `None` then will be for **all** symbols.
@@ -380,7 +388,7 @@ def get_billable_size(
380388
params: List[Tuple[str, Optional[str]]] = [
381389
("dataset", validate_semantic_string(dataset, "dataset")),
382390
("start", datetime_to_string(start)),
383-
("end", datetime_to_string(end)),
391+
("end", optional_datetime_to_string(end)),
384392
("symbols", symbols_list),
385393
("schema", str(validate_enum(schema, Schema, "schema"))),
386394
("stype_in", str(stype_in_valid)),
@@ -402,15 +410,15 @@ def get_cost(
402410
self,
403411
dataset: Union[Dataset, str],
404412
start: Union[pd.Timestamp, date, str, int],
405-
end: Union[pd.Timestamp, date, str, int],
413+
end: Optional[Union[pd.Timestamp, date, str, int]] = None,
406414
mode: Union[FeedMode, str] = "historical-streaming",
407415
symbols: Optional[Union[List[str], str]] = None,
408416
schema: Union[Schema, str] = "trades",
409417
stype_in: Optional[Union[SType, str]] = "native",
410418
limit: Optional[int] = None,
411419
) -> float:
412420
"""
413-
Request the cost in US Dollars for historical streaming or batched files
421+
Request the cost in US dollars for historical streaming or batched files
414422
from Databento.
415423
416424
Makes a `GET /metadata.get_cost` HTTP request.
@@ -420,11 +428,15 @@ def get_cost(
420428
dataset : Dataset or str
421429
The dataset code for the request.
422430
start : pd.Timestamp or date or str or int
423-
The start datetime for the request range. Assumes UTC as timezone unless otherwise specified.
431+
The start datetime for the request range (inclusive).
432+
Assumes UTC as timezone unless otherwise specified.
424433
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
425-
end : pd.Timestamp or date or str or int
426-
The end datetime for the request range. Assumes UTC as timezone unless otherwise specified.
434+
end : pd.Timestamp or date or str or int, optional
435+
The end datetime for the request range (exclusive).
436+
Assumes UTC as timezone unless otherwise specified.
427437
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
438+
Values are forward filled based on the resolution provided.
439+
Defaults to the same value as `start`.
428440
mode : FeedMode or str {'live', 'historical-streaming', 'historical'}, default 'historical-streaming'
429441
The data feed mode for the request.
430442
symbols : List[Union[str, int]] or str, optional
@@ -440,15 +452,15 @@ def get_cost(
440452
Returns
441453
-------
442454
float
443-
The cost in US Dollars.
455+
The cost in US dollars.
444456
445457
"""
446458
stype_in_valid = validate_enum(stype_in, SType, "stype_in")
447459
symbols_list = optional_symbols_list_to_string(symbols, stype_in_valid)
448-
params: List[Tuple[str, str]] = [
460+
params: List[Tuple[str, Optional[str]]] = [
449461
("dataset", validate_semantic_string(dataset, "dataset")),
450462
("start", datetime_to_string(start)),
451-
("end", datetime_to_string(end)),
463+
("end", optional_datetime_to_string(end)),
452464
("symbols", symbols_list),
453465
("schema", str(validate_enum(schema, Schema, "schema"))),
454466
("stype_in", str(stype_in_valid)),

databento/historical/api/symbology.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from databento.common.enums import SType
55
from databento.common.parsing import (
66
datetime_to_date_string,
7+
optional_date_to_string,
78
optional_symbols_list_to_string,
89
)
910
from databento.common.validation import validate_enum, validate_semantic_string
@@ -28,7 +29,7 @@ def resolve(
2829
stype_in: Union[SType, str],
2930
stype_out: Union[SType, str],
3031
start_date: Union[date, str],
31-
end_date: Union[date, str],
32+
end_date: Optional[Union[date, str]] = None,
3233
default_value: Optional[str] = "",
3334
) -> Dict[str, Any]:
3435
"""
@@ -48,7 +49,7 @@ def resolve(
4849
The output symbology type to resolve to.
4950
start_date : date or str
5051
The start date (UTC) of the request time range (inclusive).
51-
end_date : date or str
52+
end_date : date or str, optional
5253
The end date (UTC) of the request time range (exclusive).
5354
default_value : str, default '' (empty string)
5455
The default value to return if a symbol cannot be resolved.
@@ -68,7 +69,7 @@ def resolve(
6869
("stype_in", str(stype_in_valid)),
6970
("stype_out", str(validate_enum(stype_out, SType, "stype_out"))),
7071
("start_date", datetime_to_date_string(start_date)),
71-
("end_date", datetime_to_date_string(end_date)),
72+
("end_date", optional_date_to_string(end_date)),
7273
("default_value", default_value),
7374
]
7475

databento/historical/api/timeseries.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
from databento.common.deprecated import deprecated
1212
from databento.common.enums import Compression, Dataset, Encoding, Schema, SType
1313
from databento.common.error import BentoWarning
14-
from databento.common.parsing import datetime_to_string, optional_symbols_list_to_string
14+
from databento.common.parsing import (
15+
datetime_to_string,
16+
optional_datetime_to_string,
17+
optional_symbols_list_to_string,
18+
)
1519
from databento.common.validation import validate_enum, validate_semantic_string
1620
from databento.historical.api import API_VERSION
1721
from databento.historical.http import BentoHttpAPI
@@ -31,7 +35,7 @@ def stream(
3135
self,
3236
dataset: Union[Dataset, str],
3337
start: Union[pd.Timestamp, date, str, int],
34-
end: Union[pd.Timestamp, date, str, int],
38+
end: Optional[Union[pd.Timestamp, date, str, int]] = None,
3539
symbols: Optional[Union[List[str], str]] = None,
3640
schema: Union[Schema, str] = "trades",
3741
stype_in: Union[SType, str] = "native",
@@ -59,7 +63,7 @@ def get_range(
5963
self,
6064
dataset: Union[Dataset, str],
6165
start: Union[pd.Timestamp, date, str, int],
62-
end: Union[pd.Timestamp, date, str, int],
66+
end: Optional[Union[pd.Timestamp, date, str, int]] = None,
6367
symbols: Optional[Union[List[str], str]] = None,
6468
schema: Union[Schema, str] = "trades",
6569
stype_in: Union[SType, str] = "native",
@@ -83,11 +87,15 @@ def get_range(
8387
dataset : Dataset or str
8488
The dataset code (string identifier) for the request.
8589
start : pd.Timestamp or date or str or int
86-
The start datetime (UTC) of the request time range (inclusive).
90+
The start datetime of the request time range (inclusive).
91+
Assumes UTC as timezone unless passed a tz-aware object.
8792
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
88-
end : pd.Timestamp or date or str or int
89-
The end datetime (UTC) of the request time range (exclusive).
93+
end : pd.Timestamp or date or str or int, optional
94+
The end datetime of the request time range (exclusive).
95+
Assumes UTC as timezone unless passed a tz-aware object.
9096
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
97+
Values are forward filled based on the resolution provided.
98+
Defaults to the same value as `start`.
9199
symbols : List[Union[str, int]] or str, optional
92100
The product symbols to filter for. Takes up to 2,000 symbols per request.
93101
If more than 1 symbol is specified, the data is merged and sorted by time.
@@ -122,7 +130,7 @@ def get_range(
122130
params: List[Tuple[str, Optional[str]]] = [
123131
("dataset", validate_semantic_string(dataset, "dataset")),
124132
("start", datetime_to_string(start)),
125-
("end", datetime_to_string(end)),
133+
("end", optional_datetime_to_string(end)),
126134
("symbols", symbols_list),
127135
("schema", str(schema_valid)),
128136
("stype_in", str(stype_in_valid)),
@@ -166,7 +174,7 @@ async def stream_async(
166174
self,
167175
dataset: Union[Dataset, str],
168176
start: Union[pd.Timestamp, date, str, int],
169-
end: Union[pd.Timestamp, date, str, int],
177+
end: Optional[Union[pd.Timestamp, date, str, int]] = None,
170178
symbols: Optional[Union[List[str], str]] = None,
171179
schema: Union[Schema, str] = "trades",
172180
stype_in: Union[SType, str] = "native",
@@ -195,7 +203,7 @@ async def get_range_async(
195203
self,
196204
dataset: Union[Dataset, str],
197205
start: Union[pd.Timestamp, date, str, int],
198-
end: Union[pd.Timestamp, date, str, int],
206+
end: Optional[Union[pd.Timestamp, date, str, int]] = None,
199207
symbols: Optional[Union[List[str], str]] = None,
200208
schema: Union[Schema, str] = "trades",
201209
stype_in: Union[SType, str] = "native",
@@ -219,11 +227,15 @@ async def get_range_async(
219227
dataset : Dataset or str
220228
The dataset code (string identifier) for the request.
221229
start : pd.Timestamp or date or str or int
222-
The start datetime (UTC) of the request time range (inclusive).
230+
The start datetime of the request time range (inclusive).
231+
Assumes UTC as timezone unless passed a tz-aware object.
223232
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
224-
end : pd.Timestamp or date or str or int
225-
The end datetime (UTC) of the request time range (exclusive).
233+
end : pd.Timestamp or date or str or int, optional
234+
The end datetime of the request time range (exclusive).
235+
Assumes UTC as timezone unless passed a tz-aware object.
226236
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
237+
Values are forward filled based on the resolution provided.
238+
Defaults to the same value as `start`.
227239
symbols : List[Union[str, int]] or str, optional
228240
The product symbols to filter for. Takes up to 2,000 symbols per request.
229241
If more than 1 symbol is specified, the data is merged and sorted by time.
@@ -258,7 +270,7 @@ async def get_range_async(
258270
params: List[Tuple[str, Optional[str]]] = [
259271
("dataset", validate_semantic_string(dataset, "dataset")),
260272
("start", datetime_to_string(start)),
261-
("end", datetime_to_string(end)),
273+
("end", optional_datetime_to_string(end)),
262274
("symbols", symbols_list),
263275
("schema", str(schema_valid)),
264276
("stype_in", str(stype_in_valid)),

databento/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.10.0"
1+
__version__ = "0.11.0"

notebooks/quickstart.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
},
309309
"source": [
310310
"### Data cost\n",
311-
"Before making a request for data, you can query the expected price in USD. The price is determined from the following formula: `unit_cost` * `uncompressed_size_GB`."
311+
"Before making a request for data, you can query the expected price in US dollars. The price is determined from the following formula: `unit_cost` * `uncompressed_size_GB`."
312312
]
313313
},
314314
{

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ databento-dbn==0.4.3
33
numpy>=1.17.0
44
pandas>=1.1.3
55
requests>=2.24.0
6-
zstandard>=0.19.0
6+
zstandard>=0.20.0

requirements_dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mypy==1.1.1
2-
pytest>=7.2.2
1+
mypy==1.2.0
2+
pytest>=7.3.0
33
pytest-mock>=3.10.0
44
types-requests

0 commit comments

Comments
 (0)