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.
25 lines
918 B
Python
25 lines
918 B
Python
"""FINRA short volume Oracle service methods."""
|
|
from __future__ import annotations
|
|
|
|
from libs.oracle_client.client import OracleClient
|
|
from libs.oracle_client.models import ShortRatioResponse, ShortVolumeResponse
|
|
|
|
|
|
class FinraService:
|
|
def __init__(self, client: OracleClient) -> None:
|
|
self._client = client
|
|
|
|
async def get_short_volume(
|
|
self, symbol: str, days: int = 30
|
|
) -> ShortVolumeResponse:
|
|
params: dict[str, str | int] = {"days": days}
|
|
data = await self._client.get(f"/finra/short-volume/{symbol}", params=params)
|
|
return ShortVolumeResponse.model_validate(data)
|
|
|
|
async def get_short_ratio(
|
|
self, symbol: str, days: int = 30
|
|
) -> ShortRatioResponse:
|
|
params: dict[str, str | int] = {"days": days}
|
|
data = await self._client.get(f"/finra/short-ratio/{symbol}", params=params)
|
|
return ShortRatioResponse.model_validate(data)
|