cryptodatapy.extract.getdata ============================ .. py:module:: cryptodatapy.extract.getdata Classes ------- .. autoapisummary:: cryptodatapy.extract.getdata.GetData Module Contents --------------- .. py:class:: GetData(data_req: cryptodatapy.extract.datarequest.DataRequest, api_key: Optional[str] = None) Retrieves data from selected data source. .. py:attribute:: data_req .. py:attribute:: api_key :value: None .. py:method:: get_meta(attr: str = None, method: str = None, **kwargs) -> pandas.DataFrame Get metadata. :param attr: 'base_url', 'api_key', 'max_obs_per_call', 'rate_limit'}, default assets Gets the specified attribute or method from the data source object. :type attr: str, {'categories', 'exchanges', 'indexes', 'assets', 'markets', 'market_types', 'fields', 'frequencies', :param method: 'get_fields_info', 'get_frequencies_info', 'get_rate_limit_info', 'get_onchain_tickers_list', 'get_top_mkt_cap_info'} Gets the specified method from the data source object. :type method: str, {'get_exchanges_info', 'get_indexes_info', 'get_assets_info', 'get_markets_info', :param cat: Category for which to return metadata, e.g. 'crypto', 'fx', 'rates', 'macro', etc. :type cat: str, optional, default None :param exch: Name of exchange for which to return metdata, e.g. 'binance', 'ftx', 'kraken', etc. :type exch: str, default 'binance' :param data_type: Type of data for which to return metadata, e.g. 'on-chain', 'market' or 'off-chain'. :type data_type: str, {'market', 'on-chain', 'off-chain'}, default None :param as_dict: Returns attribute metadata as dictionary. :type as_dict: bool, default False :param as_list: Returns attribute metdata as list. :type as_list: bool, default False :returns: **meta** -- Metadata for selected attribute or method. :rtype: Any .. rubric:: Examples >>> data_req = DataRequest(source='ccxt') >>> GetData(data_req).get_meta(attr='exchanges') '['aax', 'alpaca', 'ascendex', 'bequant', 'bibox', 'bigone', 'binance', 'binancecoinm', 'binanceus', ...]' >>> data_req = DataRequest(source='investpy') >>> GetData(data_req).get_meta(attr='categories') '['fx', 'rates', 'eqty', 'cmdty', 'macro']' >>> data_req = DataRequest(source='ccxt') >>> GetData(data_req).get_meta(method='get_assets_info') id numericId code precision ticker 1INCH 1INCH None 1INCH 8 1INCHDOWN 1INCHDOWN None 1INCHDOWN 8 1INCHUP 1INCHUP None 1INCHUP 8 AAVE AAVE None AAVE 8 .. py:method:: get_series(method: str = 'get_data') -> pandas.DataFrame Get requested data. :param method: 'get_funding_rates', 'get_open_interest', 'get_eqty', 'get_eqty_iex', 'get_etfs', 'get_stocks', 'get_fx', 'get_rates', 'get_cmdty', 'get_crypto', 'get_macro_series'}, default 'get_data' Gets the specified method from the data source object. :type method: str, {'get_data', 'get_ohlcv', 'get_indexes', 'get_onchain', 'get_social', 'get_trades', 'get_quotes', :returns: **df** -- DataFrame with DatetimeIndex (level 0), ticker (level 1), and field (cols) values. :rtype: pd.DataFrame - MultiIndex .. rubric:: Examples >>> data_req = DataRequest(source='ccxt', tickers=['btc', 'eth'], fields=['open', 'high', 'low', 'close', 'volume'], freq='d', exch='ftx', start_date='2017-01-01') >>> GetData(data_req).get_series() open high low close volume date ticker 2020-03-28 BTC 6243.25 6298.5 6028.0 6237.5 3888.9424 ETH 128.995 133.0 125.11 131.04 1751.65972 2020-03-29 BTC 6233.5 6262.5 5869.5 5876.5 114076.5831 ETH 130.98 131.84 123.81 124.33 138449.60906 2020-03-30 BTC 5876.0 6609.0 5856.0 6396.5 224231.1718 >>> data_req = DataRequest(source='glassnode', tickers=['btc', 'eth'], fields=['add_act', 'tx_count', 'issuance'], freq='d', start_date='2016-01-01') >>> GetData(data_req).get_series() add_act tx_count issuance date ticker 2016-01-01 BTC 316489 123957 0.085386 ETH 2350 8232 0.133048 2016-01-02 BTC 419389 148893 0.09197 ETH 2410 9164 0.140147 2016-01-03 BTC 394047 142463 0.091947 .. py:method:: get_series_async(method: str = 'get_data_async') -> pandas.DataFrame :async: Get requested data. :param method: Gets the specified method from the data source object. :type method: str, default 'get_data' :returns: **df** -- DataFrame with DatetimeIndex (level 0), ticker (level 1), and field (cols) values. :rtype: pd.DataFrame - MultiIndex .. rubric:: Examples >>> data_req = DataRequest(source='ccxt', tickers=['btc', 'eth'], fields=['open', 'high', 'low', 'close', 'volume'], freq='d', exch='ftx', start_date='2017-01-01') >>> GetData(data_req).get_series() open high low close volume date ticker 2020-03-28 BTC 6243.25 6298.5 6028.0 6237.5 3888.9424 ETH 128.995 133.0 125.11 131.04 1751.65972 2020-03-29 BTC 6233.5 6262.5 5869.5 5876.5 114076.5831 ETH 130.98 131.84 123.81 124.33 138449.60906 2020-03-30 BTC 5876.0 6609.0 5856.0 6396.5 224231.1718 >>> data_req = DataRequest(source='glassnode', tickers=['btc', 'eth'], fields=['add_act', 'tx_count', 'issuance'], freq='d', start_date='2016-01-01') >>> GetData(data_req).get_series() add_act tx_count issuance date ticker 2016-01-01 BTC 316489 123957 0.085386 ETH 2350 8232 0.133048 2016-01-02 BTC 419389 148893 0.09197 ETH 2410 9164 0.140147 2016-01-03 BTC 394047 142463 0.091947