cryptodatapy.extract.adapters.vendors.base_api_vendor

Classes

BaseAPIVendorAdapter

BaseAPIVendorAdapter is the Abstract Base Class (Target Interface) for proprietary

Module Contents

class cryptodatapy.extract.adapters.vendors.base_api_vendor.BaseAPIVendorAdapter(config: Dict[str, Any] | None = None)

Bases: abc.ABC

BaseAPIVendorAdapter is the Abstract Base Class (Target Interface) for proprietary REST API data vendors. It enforces the contract for data fetching and standardization.

_api_key: str | None
_base_url: str | None
_api_endpoints: Dict[str, str] | None
_rate_limit: Any | None = None
abstractmethod get_assets_info() pandas.DataFrame

Gets info for available assets and returns a standardized DataFrame.

abstractmethod get_fields_info(data_type: str | None = None) pandas.DataFrame

Gets info for available fields and returns a standardized DataFrame.

abstractmethod get_rate_limit_info() Any | None

Gets and updates the number of API calls made and remaining.

abstractmethod _convert_params_to_vendor(data_req: cryptodatapy.core.data_request.DataRequest) Dict[str, Any]

CONVERT: Converts the DataRequest object into the vendor’s specific API parameters (URL/payload).

abstractmethod _fetch_raw_data(vendor_params: Dict[str, Any]) Dict[str, Any] | List[Dict[str, Any]]

EXTRACT: Submits the vendor-specific parameters to the API and returns the raw response.

abstractmethod _transform_raw_response(data_req: cryptodatapy.core.data_request.DataRequest, raw_data: Any) pandas.DataFrame

TRANSFORM: Processes the raw data response into the package’s standardized tidy DataFrame format.

get_data(data_req: cryptodatapy.core.data_request.DataRequest) pandas.DataFrame

Executes the full ETL cycle: convert parameters, fetch raw data, and transform into tidy DataFrame. This method acts as the Template Method for the data retrieval process.