cryptodatapy.extract.exchanges

Submodules

Classes

Exchange

Abstract base class for crypto exchanges (CEX or DEX).

Dydx

Retrieves data from dydx exchange.

Package Contents

class cryptodatapy.extract.exchanges.Exchange(name, exch_type, is_active, categories, assets, markets, market_types, fields, frequencies, fees, base_url, api_key, max_obs_per_call, rate_limit)

Bases: abc.ABC

Abstract base class for crypto exchanges (CEX or DEX).

This class provides a blueprint for interacting with crypto exchanges, including authentication, data retrieval, and trading functionality.

property name

Returns the type of exchange.

property exch_type

Returns the type of exchange.

property is_active

Returns whether the exchange is active.

property categories

Returns a list of available categories for the data vendor.

property assets

Returns a list of available assets for the data vendor.

property markets

Returns a list of available markets for the data vendor.

property market_types

Returns a list of available market types for the data vendor.

property fields

Returns a list of available fields for the data vendor.

property frequencies

Returns a list of available data frequencies for the data vendor.

property fees

Returns a list of fees for the data vendor.

property base_url

Returns the base url for the data vendor.

property api_key

Returns the api key for the data vendor.

property max_obs_per_call

Returns the maximum observations per API call for the data vendor.

property rate_limit

Returns the number of API calls made and remaining.

abstractmethod get_assets_info()

Gets info for available assets from the data vendor.

abstractmethod get_markets_info()

Gets info for available markets from the data vendor.

abstractmethod get_fields_info(data_type: str | None)

Gets info for available fields from the data vendor.

abstractmethod get_frequencies_info(data_type: str | None)

Gets info for available frequencies from the exchange.

abstractmethod get_rate_limit_info()

Gets the number of API calls made and remaining.

abstractmethod get_metadata() None

Get exchange metadata.

abstractmethod get_data(data_req) pandas.DataFrame

Submits get data request to API.

static _wrangle_data_resp(data_req: cryptodatapy.extract.datarequest.DataRequest, data_resp: Dict[str, Any] | pandas.DataFrame) pandas.DataFrame
Abstractmethod:

Wrangles data response from data vendor API into tidy format.

class cryptodatapy.extract.exchanges.Dydx(name: str = 'dydx', exch_type: str = 'dex', is_active: bool = True, categories: str | List[str] = 'crypto', assets: Dict[str, List[str]] | None = None, markets: Dict[str, List[str]] | None = None, market_types: List[str] = ['spot', 'future', 'perpetual_future', 'option'], fields: List[str] | None = ['open', 'high', 'low', 'close', 'volume', 'funding_rate', 'oi'], frequencies: Dict[str, str | int] | None = None, fees: Dict[str, float] | None = {'spot': {'maker': 0.0, 'taker': 0.0}, 'perpetual_future': {'maker': 0.0, 'taker': 0.0}}, base_url: str | None = None, api_key: str | None = None, max_obs_per_call: int | None = None, rate_limit: Any | None = None)

Bases: cryptodatapy.extract.exchanges.exchange.Exchange

Retrieves data from dydx exchange.

data_req = None
data
get_assets_info()
get_markets_info()
get_fields_info(data_type: str | None)
get_frequencies_info()
get_rate_limit_info()
get_metadata()
_fetch_ohlcv()
_fetch_funding_rates()
_fetch_open_interest()
_convert_params()
static _wrangle_data_resp(data_req: cryptodatapy.extract.datarequest.DataRequest, data_resp: Dict[str, Any] | pandas.DataFrame) pandas.DataFrame
_fetch_tidy_ohlcv()
_fetch_tidy_funding_rates()
_fetch_tidy_open_interest()
get_data(data_req) pandas.DataFrame