1616from databento .common .parsing import optional_datetime_to_string
1717from databento .common .parsing import optional_symbols_list_to_list
1818from databento .common .validation import validate_enum
19- from databento .common .validation import validate_maybe_enum
2019from databento .common .validation import validate_semantic_string
2120from databento .historical .api import API_VERSION
2221from databento .historical .http import BentoHttpAPI
@@ -31,17 +30,17 @@ def __init__(self, key: str, gateway: str) -> None:
3130 super ().__init__ (key = key , gateway = gateway )
3231 self ._base_url = gateway + f"/v{ API_VERSION } /metadata"
3332
34- def list_publishers (self ) -> dict [str , int ]:
33+ def list_publishers (self ) -> list [ dict [str , Any ] ]:
3534 """
3635 Request all publishers from Databento.
3736
3837 Makes a `GET /metadata.list_publishers` HTTP request.
3938
40- Use this method to list the mappings of publisher names to publisher IDs .
39+ Use this method to list the details of publishers, including their dataset and venue mappings .
4140
4241 Returns
4342 -------
44- dict[str, int ]
43+ list[ dict[str, Any] ]
4544
4645 """
4746 response : Response = self ._get (
@@ -56,11 +55,11 @@ def list_datasets(
5655 end_date : date | str | None = None ,
5756 ) -> list [str ]:
5857 """
59- Request all available datasets from Databento.
58+ Request all valid dataset codes from Databento.
6059
6160 Makes a `GET /metadata.list_datasets` HTTP request.
6261
63- Use this method to list the _names_ of all available datasets , so you
62+ Use this method to list the valid dataset _codes (string identifiers) , so you
6463 can use other methods which take the `dataset` parameter.
6564
6665 Parameters
@@ -118,82 +117,67 @@ def list_schemas(self, dataset: Dataset | str) -> list[str]:
118117
119118 def list_fields (
120119 self ,
121- dataset : Dataset | str ,
122- schema : Schema | str | None = None ,
123- encoding : Encoding | str | None = None ,
124- ) -> dict [str , dict [str , str ]]:
120+ schema : Schema | str ,
121+ encoding : Encoding | str ,
122+ ) -> list [dict [str , Any ]]:
125123 """
126- Request all fields for a dataset, schema and encoding from Databento.
124+ List all fields for a particular schema and encoding from Databento.
127125
128126 Makes a `GET /metadata.list_fields` HTTP request.
129127
130- The `schema` and `encoding` parameters act as optional filters. All
131- metadata for that parameter is returned if they are not specified.
132-
133128 Parameters
134129 ----------
135- dataset : Dataset or str
136- The dataset code (string identifier) for the request.
137- schema : Schema or str {'mbo', 'mbp-1', 'mbp-10', 'trades', 'tbbo', 'ohlcv-1s', 'ohlcv-1m', 'ohlcv-1h', 'ohlcv-1d', 'definition', 'statistics', 'status'}, optional # noqa
130+ schema : Schema or str {'mbo', 'mbp-1', 'mbp-10', 'trades', 'tbbo', 'ohlcv-1s', 'ohlcv-1m', 'ohlcv-1h', 'ohlcv-1d', 'definition', 'statistics', 'status'},
138131 The data record schema for the request.
139- encoding : Encoding or str {'dbn', 'csv', 'json'}, optional
132+ encoding : Encoding or str {'dbn', 'csv', 'json'}
140133 The data encoding.
141134
142135 Returns
143136 -------
144- dict[str, dict[str, str ]]
145- A mapping of dataset to encoding to schema to field to data type .
137+ list[ dict[str, Any ]]
138+ A list of field details .
146139
147140 """
148- params : list [tuple [str , Dataset | Schema | Encoding | str | None ]] = [
149- ("dataset" , validate_semantic_string (dataset , "dataset" )),
150- ("schema" , validate_maybe_enum (schema , Schema , "schema" )),
151- ("encoding" , validate_maybe_enum (encoding , Encoding , "encoding" )),
141+ params : list [tuple [str , str | Any ]] = [
142+ ("schema" , validate_enum (schema , Schema , "schema" )),
143+ ("encoding" , validate_enum (encoding , Encoding , "encoding" )),
152144 ]
153145
154146 response : Response = self ._get (
155147 url = self ._base_url + ".list_fields" ,
156- params = params , # type: ignore [arg-type]
148+ params = params ,
157149 basic_auth = True ,
158150 )
159151 return response .json ()
160152
161153 def list_unit_prices (
162154 self ,
163155 dataset : Dataset | str ,
164- mode : FeedMode | str | None = None ,
165- schema : Schema | str | None = None ,
166- ) -> float | dict [str , Any ]:
156+ ) -> list [dict [str , Any ]]:
167157 """
168- List unit prices for each data schema in US dollars per gigabyte.
158+ List unit prices for each feed mode and data schema in US dollars per
159+ gigabyte.
169160
170161 Makes a `GET /metadata.list_unit_prices` HTTP request.
171162
172163 Parameters
173164 ----------
174165 dataset : Dataset or str
175166 The dataset code for the request.
176- mode : FeedMode or str {'live', 'historical-streaming', 'historical'}, optional
177- The data feed mode for the request.
178- schema : Schema or str {'mbo', 'mbp-1', 'mbp-10', 'trades', 'tbbo', 'ohlcv-1s', 'ohlcv-1m', 'ohlcv-1h', 'ohlcv-1d', 'definition', 'statistics', 'status'}, optional # noqa
179- The data record schema for the request.
180167
181168 Returns
182169 -------
183- float or dict[str, Any]
184- If both `mode` and `schema` are specified, the unit price is returned as a single number.
185- Otherwise, return a map of feed mode to schema to unit price.
170+ list[dict[str, Any]]
171+ A list of maps of feed mode to schema to unit price.
186172
187173 """
188- params : list [tuple [str , Dataset | FeedMode | Schema | str | None ]] = [
174+ params : list [tuple [str , Dataset | str ]] = [
189175 ("dataset" , validate_semantic_string (dataset , "dataset" )),
190- ("mode" , validate_maybe_enum (mode , FeedMode , "mode" )),
191- ("schema" , validate_maybe_enum (schema , Schema , "schema" )),
192176 ]
193177
194178 response : Response = self ._get (
195179 url = self ._base_url + ".list_unit_prices" ,
196- params = params , # type: ignore [arg-type]
180+ params = params ,
197181 basic_auth = True ,
198182 )
199183 return response .json ()
0 commit comments