You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
822 B
Python
22 lines
822 B
Python
"""Financial data Oracle service methods."""
|
|
from __future__ import annotations
|
|
|
|
from libs.oracle_client.client import OracleClient
|
|
from libs.oracle_client.models import CompanyInfo, FinancialDataResponse
|
|
|
|
|
|
class FinancialService:
|
|
def __init__(self, client: OracleClient) -> None:
|
|
self._client = client
|
|
|
|
async def get_financial_data(
|
|
self, ticker: str, quarters: int = 8
|
|
) -> FinancialDataResponse:
|
|
params: dict[str, str | int] = {"ticker": ticker, "quarters": quarters}
|
|
data = await self._client.get("/financial/data", params=params)
|
|
return FinancialDataResponse.model_validate(data)
|
|
|
|
async def get_company_info(self, ticker: str) -> CompanyInfo:
|
|
data = await self._client.get(f"/financial/company/{ticker}")
|
|
return CompanyInfo.model_validate(data)
|