data_client
Classes
The main public interface (Facade) for fetching data and metadata. |
Module Contents
- class data_client.DataClient(source_config: Dict[str, Dict[str, Any]] | None = None)
The main public interface (Facade) for fetching data and metadata. It selects, delegates, and caches the appropriate vendor adapter.
- ADAPTER_MAPPING: Dict[str, Type[cryptodatapy.extract.adapters.base_adapter.BaseAdapter]]
- _source_config
- _adapters: Dict[str, cryptodatapy.extract.adapters.base_adapter.BaseAdapter]
- _get_adapter(source_name: str) cryptodatapy.extract.adapters.base_adapter.BaseAdapter
Retrieves an instantiated adapter from the cache, or instantiates and caches it if missing. This handles lazy loading and passing the correct, vendor-specific configuration.
- Parameters:
source_name (str) – The name of the data source/vendor (e.g., ‘defillama’, ‘coinmetrics’, ‘ccxt’).
- get_data(request: cryptodatapy.core.data_request.DataRequest) pandas.DataFrame
Routes the standardized DataRequest to the correct data source adapter and returns the result.
- Parameters:
request (DataRequest) – The standardized data request object containing all necessary parameters.
- Returns:
A DataFrame containing the requested time series data.
- Return type:
pd.DataFrame
- get_assets_info(source_name: str, as_list: bool = False, **kwargs) pandas.DataFrame | list
Delegates the request for canonical asset metadata to the specified data source adapter.
- Parameters:
source_name (str) – The data source to use for fetching asset info. Default is ‘defillama’.
as_list (bool) – If True, returns a list of asset identifiers instead of a DataFrame.
- Returns:
A DataFrame containing asset metadata.
- Return type:
pd.DataFrame
- get_markets_info(source_name: str, as_list: bool = False, **kwargs) pandas.DataFrame | list
Delegates the request for market metadata to the specified data source adapter.
- Parameters:
source_name (str) – The data source to use for fetching market info. Default is ‘defillama’.
as_list (bool) – If True, returns a list of market identifiers instead of a DataFrame.
- Returns:
A DataFrame containing market metadata.
- Return type:
pd.DataFrame
- get_fields_info(source_name: str, as_list: bool = False, **kwargs) pandas.DataFrame | list
Delegates the request for field (metric) definitions to the specified data source adapter.
- Parameters:
source_name (str) – The data source to use for fetching field info. Default is ‘defillama’.
as_list (bool) – If True, returns a list of field/metric names instead of a DataFrame.
- Returns:
A DataFrame containing field/metric definitions.
- Return type:
pd.DataFrame