55
66import pandas as pd
77from databento .common .bento import Bento
8+ from databento .common .deprecated import deprecated
89from databento .common .enums import Compression , Dataset , Encoding , Schema , SType
910from databento .common .parsing import datetime_to_string , optional_symbols_list_to_string
1011from databento .common .validation import validate_enum
@@ -22,6 +23,7 @@ def __init__(self, key: str, gateway: str) -> None:
2223 super ().__init__ (key = key , gateway = gateway )
2324 self ._base_url = gateway + f"/v{ API_VERSION } /timeseries"
2425
26+ @deprecated
2527 def stream (
2628 self ,
2729 dataset : Union [Dataset , str ],
@@ -33,11 +35,39 @@ def stream(
3335 stype_out : Union [SType , str ] = "product_id" ,
3436 limit : Optional [int ] = None ,
3537 path : Optional [Union [Path , str ]] = None ,
38+ ) -> Bento :
39+ """
40+ The `.stream` method is deprecated and will be removed in a future version.
41+ The method has been renamed to `.get_range`, which you can now use.
42+ """
43+ return self .get_range (
44+ dataset = dataset ,
45+ start = start ,
46+ end = end ,
47+ symbols = symbols ,
48+ schema = schema ,
49+ stype_in = stype_in ,
50+ stype_out = stype_out ,
51+ limit = limit ,
52+ path = path ,
53+ )
54+
55+ def get_range (
56+ self ,
57+ dataset : Union [Dataset , str ],
58+ start : Union [pd .Timestamp , date , str , int ],
59+ end : Union [pd .Timestamp , date , str , int ],
60+ symbols : Optional [Union [List [str ], str ]] = None ,
61+ schema : Union [Schema , str ] = "trades" ,
62+ stype_in : Union [SType , str ] = "native" ,
63+ stype_out : Union [SType , str ] = "product_id" ,
64+ limit : Optional [int ] = None ,
65+ path : Optional [Union [Path , str ]] = None ,
3666 ) -> Bento :
3767 """
3868 Request a historical time series data stream from Databento.
3969
40- Makes a `GET /timeseries.stream ` HTTP request.
70+ Makes a `GET /timeseries.get_range ` HTTP request.
4171
4272 Primary method for getting historical intraday market data, daily data,
4373 instrument definitions and market status data directly into your application.
@@ -114,15 +144,15 @@ def stream(
114144 bento : Bento = self ._create_bento (path = path )
115145
116146 self ._stream (
117- url = self ._base_url + ".stream " ,
147+ url = self ._base_url + ".get_range " ,
118148 params = params ,
119149 basic_auth = True ,
120150 bento = bento ,
121151 )
122152
123153 return bento
124154
125- async def stream_async (
155+ async def get_range_async (
126156 self ,
127157 dataset : Union [Dataset , str ],
128158 start : Union [pd .Timestamp , date , str , int ],
@@ -137,7 +167,7 @@ async def stream_async(
137167 """
138168 Request a historical time series data stream from Databento asynchronously.
139169
140- Makes a `GET /timeseries.stream ` HTTP request.
170+ Makes a `GET /timeseries.get_range ` HTTP request.
141171
142172 Primary method for getting historical intraday market data, daily data,
143173 instrument definitions and market status data directly into your application.
@@ -213,7 +243,7 @@ async def stream_async(
213243 bento : Bento = self ._create_bento (path = path )
214244
215245 await self ._stream_async (
216- url = self ._base_url + ".stream " ,
246+ url = self ._base_url + ".get_range " ,
217247 params = params ,
218248 basic_auth = True ,
219249 bento = bento ,
0 commit comments