Skip to content

Commit

Permalink
index_snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
deeleeramone committed May 15, 2024
1 parent 4837aee commit bb95edf
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""CBOE Index Snapshots Model."""

# pylint: disable=unused-argument

from datetime import datetime
from typing import Any, Dict, List, Literal, Optional

Expand Down Expand Up @@ -29,7 +31,7 @@ class CboeIndexSnapshotsQueryParams(IndexSnapshotsQueryParams):
@classmethod
def validate_region(cls, v):
"""Validate region."""
return "us" if v is None else v
return v if v else "us"


class CboeIndexSnapshotsData(IndexSnapshotsData):
Expand Down Expand Up @@ -89,11 +91,11 @@ def transform_query(params: Dict[str, Any]) -> CboeIndexSnapshotsQueryParams:
@staticmethod
async def aextract_data(
query: CboeIndexSnapshotsQueryParams,
credentials: Optional[Dict[str, str]], # pylint: disable=unused-argument
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[Dict]:
"""Return the raw data from the Cboe endpoint"""

url: str = ""
if query.region == "us":
url = "https://cdn.cboe.com/api/global/delayed_quotes/quotes/all_us_indices.json"
if query.region == "eu":
Expand All @@ -104,9 +106,9 @@ async def aextract_data(

@staticmethod
def transform_data(
query: CboeIndexSnapshotsQueryParams, # pylint: disable=unused-argument
data: dict,
**kwargs: Any, # pylint: disable=unused-argument
query: CboeIndexSnapshotsQueryParams,
data: List[Dict],
**kwargs: Any,
) -> List[CboeIndexSnapshotsData]:
"""Transform the data to the standard format"""
if not data:
Expand Down

0 comments on commit bb95edf

Please sign in to comment.