cryptodatapy.util
Submodules
Classes
Data catalog which makes it easy to find, extract, use, and share CryptoDataPy datasets. |
|
Stores data credentials used by the CryptoDataPy project for data extraction, storage, etc. |
Package Contents
- class cryptodatapy.util.DataCatalog
Data catalog which makes it easy to find, extract, use, and share CryptoDataPy datasets.
- Parameters:
data_sources (str) – Name and url of available data sources.
- data_sources: Dict
- static get_tickers_metadata(tickers: str | List[str] | None = None, country_id_2: str | None = None, country_id_3: str | None = None, country_name: str | None = None, agg: str | None = None, cat: str | None = None, subcat: str | None = None, mkt_type: str | None = None, quote_ccy: str | None = None, as_list=False)
Gets ticker metadata. Excludes individual equity and cryptoasset tickers.
- Parameters:
tickers (str or list, optional, default None) – Tickers for which to get metadata.
country_id_2 (str, optional, default None) – Country code for which to filter tickers, ISO 3166-1 alpha-2 format.
country_id_3 (str, optional, default None) – Country code for which to filter tickers, ISO 3166-1 alpha-3 format.
country_name (str, optional, default None) – Country name for which to filer tickers.
agg (str, {'DM', 'EM', 'WL', 'Euro zone'}, optional, default None) – Country aggregate.
cat (str, {'crypto', 'fx', 'cmdty', 'eqty', 'rates', 'bonds', 'credit', 'macro', 'alt'}) – Tickers category.
subcat (str, { 'spot rate', 'index', 'effective exchange rate', 'yield', 'swap rate', 'real yield',) –
- ‘inflation’, ‘spread’, ‘etf’, ‘vol’, ‘reit’, ‘industrial metals’, ‘grains’, ‘energy’, ‘softs’,
’livestock’, ‘precious metals’, ‘growth’, ‘unemployment’, ‘money’, ‘credit’, ‘property’}, optional, default None
Tickers subcategory.
mkt_type (str, {'spot', 'etf', 'perpetual_future', 'future', 'swap', 'option'}, optional, default None) – Market type, e.g. ‘spot ‘, ‘future’, ‘perpetual_future’, ‘option’.
quote_ccy (str, optional, default None) – Quote currency for base asset, e.g. ‘GBP’ for EURGBP, ‘USD’ for BTCUSD (bitcoin in dollars), etc.
as_list (bool, default False) – Returns requested tickers as list.
- Returns:
tickers_df – DataFrame with requested tickers metadata.
- Return type:
pd.DataFrame
- static search_tickers(by_col: str | None = None, keyword: str | None = None)
Searches for tickers metadata.
- Parameters:
by_col (str, optional, default None) – Column by which to search.
keyword (str, optional, default None) – Keyword for which to search.
- Returns:
tickers_df – DataFrame with requested tickers metadata.
- Return type:
pd.DataFrame
- static get_fields_metadata(fields: str | List[str] | None = None, name: str | None = None, cat: str | None = None, subcat: str | None = None, as_list=False)
Gets fields metadata.
- Parameters:
fields (str or list, optional, default None) – Field ids for which to get metadata.
name (str, optional, default None) – Name of fields for which to get metadata.
cat (str, {'all', 'market', 'on-chain', 'off-chain'}, optional, default None) – Fields category, i.e. type of data.
subcat (str, optional, default None) – Fields subcategory.
as_list (bool, False) – Returns requested fields as list.
- Returns:
fields_df – DataFrame with requested fields metadata.
- Return type:
pd.DataFrame
- static search_fields(by_col: str | None = None, keyword: str | None = None)
Searches for fields metadata.
- Parameters:
by_col (str, optional, default None) – Column by which to search.
keyword (str, optional, default None) – Keyword for which to search.
- Returns:
fields_df – DataFrame with fields metadata.
- Return type:
pd.DataFrame
- static scrape_stablecoins(source: str = 'coingecko', rank_by: str = 'mkt_cap', as_list=False) pandas.DataFrame | list
Web scrapes stablecoin information from websites.
- Parameters:
source (str, {'coinmarketcap', 'coingecko'}, default 'coingecko') – Website from which to scrape list of stablecoins.
rank_by (str, default 'mkt_cap') – Metrics by which to rank stablecoins.
as_list (bool, default False) – Return stablecoins tickers as list.
- Returns:
sc – DataFrame with stablecoin info or list of stablecoin tickers.
- Return type:
Pd.Dataframe or list
- class cryptodatapy.util.DataCredentials
Stores data credentials used by the CryptoDataPy project for data extraction, storage, etc.
- postgresql_db_address: str = None
- postgresql_db_port: str = None
- postgresql_db_username: str = None
- postgresql_db_password: str = None
- postgresql_db_name: str = None
- mongo_db_username: str = None
- mongo_db_password: str = None
- mongo_db_name: str = None
- cryptocompare_api_key: str
- defillama_api_key: str
- coingecko_api_key: str
- glassnode_api_key: str
- tiingo_api_key: str
- alpha_vantage_api_key: str
- polygon_api_key: str
- coinmetrics_api_key: str
- cryptocompare_base_url: str = 'https://min-api.cryptocompare.com/data/'
- glassnode_base_url: str = 'https://api.glassnode.com/v1/metrics/'
- tiingo_base_url: str = 'https://api.tiingo.com/tiingo/'
- aqr_base_url: str = 'https://www.aqr.com/-/media/AQR/Documents/Insights/Data-Sets/'
- polygon_base_url: str = 'https://api.polygon.io/v3/reference/'
- defillama_base_url: str = 'https://pro-api.llama.fi/'
- property coinmetrics_base_url: str
Dynamically sets the CoinMetrics base URL based on whether an API key is provided. Uses the paid V4 endpoint if a key is present, otherwise defaults to the community V4 endpoint.
- cryptomcompare_endpoints: dict
- defillama_endpoints: dict
- cryptocompare_api_rate_limit: str = 'https://min-api.cryptocompare.com/stats/rate/limit'
- dbnomics_vendors_url: str = 'https://db.nomics.world/providers'
- pdr_vendors_url: str = 'https://pandas-datareader.readthedocs.io/en/latest/readers/index.html'
- dbnomics_search_url: str = 'https://db.nomics.world/'