Skip to content

Commit c3557f6

Browse files
authored
VER: Release 0.63.0
See release notes.
2 parents ab1772b + 7ac602c commit c3557f6

File tree

9 files changed

+70
-26
lines changed

9 files changed

+70
-26
lines changed

CHANGELOG.md

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

3+
## 0.63.0 - 2025-09-02
4+
5+
#### Enhancements
6+
- Upgraded `databento-dbn` to 0.41.0
7+
8+
#### Bug fixes
9+
- Fixed an issue where calling `Live.stop()` would not clean up the client state once the socket is closed
10+
311
## 0.62.0 - 2025-08-19
412

513
This release delivers a number of breaking changes to the Python interface for DBN records to provide a cleaner and more consistent API.

databento/historical/api/batch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ def submit_job(
9696
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
9797
The data record schema for the request.
9898
start : pd.Timestamp, datetime, date, str, or int
99-
The start of the request time range (inclusive).
99+
The inclusive start of the request range.
100100
Filters on `ts_recv` if it exists in the schema, otherwise `ts_event`.
101101
Assumes UTC as timezone unless passed a tz-aware object.
102102
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
103103
end : pd.Timestamp, datetime, date, str, or int, optional
104-
The end of the request time range (exclusive).
104+
The exclusive end of the request range.
105105
Filters on `ts_recv` if it exists in the schema, otherwise `ts_event`.
106106
Assumes UTC as timezone unless passed a tz-aware object.
107107
If an integer is passed, then this represents nanoseconds since the UNIX epoch.

databento/historical/api/metadata.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ def list_datasets(
6767
Parameters
6868
----------
6969
start_date : date or str, optional
70-
The start date (UTC) for the request range.
70+
The inclusive UTC start date of the request range.
7171
If `None` then first date available.
7272
end_date : date or str, optional
73-
The end date (UTC) for the request range.
73+
The exclusive UTC end date of the request range.
7474
If `None` then last date available.
7575
7676
Returns
@@ -202,10 +202,10 @@ def get_dataset_condition(
202202
dataset : Dataset or str
203203
The dataset code (string identifier) for the request.
204204
start_date : date or str, optional
205-
The start date (UTC) for the request range.
205+
The inclusive UTC start date of the request range.
206206
If `None` then first date available.
207207
end_date : date or str, optional
208-
The end date (UTC) for the request range.
208+
The inclusive UTC end date of the request range.
209209
If `None` then last date available.
210210
211211
Returns
@@ -279,11 +279,11 @@ def get_record_count(
279279
dataset : Dataset or str
280280
The dataset code for the request.
281281
start : pd.Timestamp, datetime, date, str, or int
282-
The start datetime for the request range (inclusive).
282+
The inclusive start of the request range.
283283
Assumes UTC as timezone unless otherwise specified.
284284
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
285285
end : pd.Timestamp, datetime, date, str, or int, optional
286-
The end datetime for the request range (exclusive).
286+
The exclusive end of the request range.
287287
Assumes UTC as timezone unless otherwise specified.
288288
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
289289
Defaults to the forward filled value of `start` based on the resolution provided.
@@ -347,11 +347,11 @@ def get_billable_size(
347347
dataset : Dataset or str
348348
The dataset code for the request.
349349
start : pd.Timestamp, datetime, date, str, or int
350-
The start datetime for the request range (inclusive).
350+
The inclusive start of the request range.
351351
Assumes UTC as timezone unless otherwise specified.
352352
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
353353
end : pd.Timestamp, datetime, date, str, or int, optional
354-
The end datetime for the request range (exclusive).
354+
The exclusive end of the request range.
355355
Assumes UTC as timezone unless otherwise specified.
356356
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
357357
Defaults to the forward filled value of `start` based on the resolution provided.
@@ -417,11 +417,11 @@ def get_cost(
417417
dataset : Dataset or str
418418
The dataset code for the request.
419419
start : pd.Timestamp, datetime, date, str, or int
420-
The start datetime for the request range (inclusive).
420+
The inclusive start of the request range.
421421
Assumes UTC as timezone unless otherwise specified.
422422
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
423423
end : pd.Timestamp, datetime, date, str, or int, optional
424-
The end datetime for the request range (exclusive).
424+
The exclusive end of the request range.
425425
Assumes UTC as timezone unless otherwise specified.
426426
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
427427
Defaults to the forward filled value of `start` based on the resolution provided.

databento/historical/api/symbology.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ def resolve(
5151
stype_out : SType or str, default 'instrument_id'
5252
The output symbology type to resolve to.
5353
start_date : date or str
54-
The start date (UTC) of the request time range (inclusive).
54+
The inclusive UTC start date of the request range.
5555
end_date : date or str, optional
56-
The end date (UTC) of the request time range (exclusive).
56+
The exclusive UTC end date of the request range.
57+
Defaults to the forward filled value of `start` based on the resolution provided.
5758
5859
Returns
5960
-------

databento/historical/api/timeseries.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ def get_range(
6060
dataset : Dataset or str
6161
The dataset code (string identifier) for the request.
6262
start : pd.Timestamp, datetime, date, str, or int
63-
The start datetime of the request time range (inclusive).
63+
The inclusive start of the request range.
6464
Filters on `ts_recv` if it exists in the schema, otherwise `ts_event`.
6565
Assumes UTC as timezone unless passed a tz-aware object.
6666
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
6767
end : pd.Timestamp, datetime, date, str, or int, optional
68-
The end datetime of the request time range (exclusive).
68+
The exclusive end of the request range.
6969
Filters on `ts_recv` if it exists in the schema, otherwise `ts_event`.
7070
Assumes UTC as timezone unless passed a tz-aware object.
7171
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
@@ -158,12 +158,12 @@ async def get_range_async(
158158
dataset : Dataset or str
159159
The dataset code (string identifier) for the request.
160160
start : pd.Timestamp, datetime, date, str, or int
161-
The start of the request time range (inclusive).
161+
The inclusive start of the request range.
162162
Filters on `ts_recv` if it exists in the schema, otherwise `ts_event`.
163163
Assumes UTC as timezone unless passed a tz-aware object.
164164
If an integer is passed, then this represents nanoseconds since the UNIX epoch.
165165
end : pd.Timestamp, datetime, date, str, or int, optional
166-
The end of the request time range (exclusive).
166+
The exclusive end of the request range.
167167
Filters on `ts_recv` if it exists in the schema, otherwise `ts_event`.
168168
Assumes UTC as timezone unless passed a tz-aware object.
169169
If an integer is passed, then this represents nanoseconds since the UNIX epoch.

databento/live/session.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,9 @@ def stop(self) -> None:
439439
with self._lock:
440440
if self._transport is None:
441441
return
442-
if self._transport.can_write_eof():
443-
self._transport.write_eof()
444-
self._transport.close()
442+
if self._protocol is not None:
443+
self._protocol.disconnected.add_done_callback(lambda _: self._cleanup())
444+
self._loop.call_soon_threadsafe(self._transport.close)
445445

446446
def start(self) -> None:
447447
"""
@@ -516,8 +516,6 @@ def terminate(self) -> None:
516516
with self._lock:
517517
if self._transport is None:
518518
return
519-
if self._transport.can_write_eof():
520-
self._transport.write_eof()
521519
self._transport.abort()
522520
self._cleanup()
523521

databento/version.py

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

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "databento"
3-
version = "0.62.0"
3+
version = "0.63.0"
44
description = "Official Python client library for Databento"
55
authors = [
66
"Databento <support@databento.com>",
@@ -32,7 +32,7 @@ aiohttp = [
3232
{version = "^3.8.3", python = "<3.12"},
3333
{version = "^3.9.0", python = "^3.12"}
3434
]
35-
databento-dbn = "~=0.40.0"
35+
databento-dbn = "~=0.41.0"
3636
numpy = [
3737
{version = ">=1.23.5", python = "<3.12"},
3838
{version = ">=1.26.0", python = "^3.12"}

tests/test_live_client.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from __future__ import annotations
66

7+
import asyncio
78
import pathlib
89
import platform
910
import random
@@ -255,6 +256,42 @@ async def test_live_connect_auth(
255256
assert message.encoding == Encoding.DBN
256257

257258

259+
async def test_live_client_reuse(
260+
mock_live_server: MockLiveServerInterface,
261+
live_client: client.Live,
262+
) -> None:
263+
"""
264+
Test that calling stop will *eventually* close a the connection and trigger
265+
a cleanup of the client state.
266+
"""
267+
live_client.subscribe(
268+
dataset=Dataset.GLBX_MDP3,
269+
schema=Schema.MBO,
270+
)
271+
272+
await mock_live_server.wait_for_message_of_type(
273+
message_type=gateway.AuthenticationRequest,
274+
)
275+
276+
live_client.start()
277+
live_client.stop()
278+
279+
await asyncio.sleep(1)
280+
281+
live_client.subscribe(
282+
dataset=Dataset.GLBX_MDP3,
283+
schema=Schema.MBP_1,
284+
)
285+
286+
await mock_live_server.wait_for_message_of_type(
287+
message_type=gateway.AuthenticationRequest,
288+
)
289+
290+
live_client.start()
291+
live_client.stop()
292+
await live_client.wait_for_close()
293+
294+
258295
async def test_live_connect_auth_with_heartbeat_interval(
259296
mock_live_server: MockLiveServerInterface,
260297
test_live_api_key: str,

0 commit comments

Comments
 (0)