feat(taapi): add get_stocks method to retrieve supported stocks
This commit is contained in:
parent
e772fed6d8
commit
22c43b51c7
@ -78,6 +78,24 @@ class TaapiClient:
|
|||||||
|
|
||||||
return self._session.get(url, params=params, timeout=timeout)
|
return self._session.get(url, params=params, timeout=timeout)
|
||||||
|
|
||||||
|
def get_available_tickers(self) -> list[str] | None:
|
||||||
|
"""
|
||||||
|
Retrieves a list of supported stocks from the TAAPI API.
|
||||||
|
"""
|
||||||
|
target_url = f"{self._base_url}/exchange-symbols"
|
||||||
|
|
||||||
|
params: dict[str, str | int | bool] = {
|
||||||
|
"secret": self._api_key,
|
||||||
|
"type": "stocks",
|
||||||
|
}
|
||||||
|
|
||||||
|
response = self._do_get(target_url, params)
|
||||||
|
|
||||||
|
if response.status_code != 200:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return list(response.json())
|
||||||
|
|
||||||
def query_indicator(
|
def query_indicator(
|
||||||
self,
|
self,
|
||||||
ticker: str,
|
ticker: str,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user