feat(taapi): add get_stocks method to retrieve supported stocks

This commit is contained in:
Giulio De Pasquale 2025-10-15 17:24:14 +01:00
parent e772fed6d8
commit 22c43b51c7

View File

@ -78,6 +78,24 @@ class TaapiClient:
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(
self,
ticker: str,