fmp_py.fmp_crypto

Classes

FmpCrypto

Module Contents

class fmp_py.fmp_crypto.FmpCrypto(api_key: str = os.getenv('FMP_API_KEY'))

Bases: fmp_py.fmp_base.FmpBase

crypto_daily(symbol: str) pandas.DataFrame

Retrieves daily crypto data for a given symbol. :param symbol: The symbol for the crypto pair. :type symbol: str

Returns:

A DataFrame containing the historical daily crypto data.

Return type:

pd.DataFrame

Raises:

ValueError – If no data is found for the given symbol.

intraday_crypto_quote(symbol: str, interval: str, from_date: str, to_date: str) pandas.DataFrame

Retrieves intraday crypto quotes for a given symbol within a specified time interval. :param symbol: The symbol of the crypto pair. :type symbol: str :param interval: The time interval for the quotes. Must be one of: 1min, 5min, 15min, 30min, 1hour, 4hour, 1day, 1week, 1month. :type interval: str :param from_date: The starting date for the quotes in the format “YYYY-MM-DD”. :type from_date: str :param to_date: The ending date for the quotes in the format “YYYY-MM-DD”. :type to_date: str

Returns:

A DataFrame containing the intraday crypto quotes with the following columns:
  • date: The date and time of the quote.

  • open: The opening price of the crypto pair.

  • high: The highest price of the crypto pair during the interval.

  • low: The lowest price of the crypto pair during the interval.

  • close: The closing price of the crypto pair.

  • volume: The trading volume during the interval.

Return type:

pd.DataFrame

Raises:
  • ValueError – If the from_date is greater than the to_date.

  • ValueError – If an invalid interval is provided.

  • ValueError – If no data is found for the given symbol.

full_crypto_quote(symbol: str) pandas.DataFrame

Retrieves the full crypto quote for a given symbol. :param symbol: The symbol for the crypto quote. :type symbol: str

Returns:

A DataFrame containing the full crypto quote data.

Return type:

pd.DataFrame

Raises:

ValueError – If no data is found for the given symbol.

crypto_list() pandas.DataFrame

Retrieves a list of available crypto currency pairs. :returns:

A DataFrame containing the following columns:
  • symbol: The symbol of the currency pair.

  • name: The name of the currency pair.

  • currency: The currency of the currency pair.

  • stock_exchange: The stock exchange of the currency pair.

  • exchange_short_name: The short name of the stock exchange.

Return type:

pd.DataFrame

Raises:

ValueError – If no data is found.

full_crypto_quote_list() pandas.DataFrame

Retrieves a full list of crypto quotes. :returns:

A DataFrame containing the crypto quotes with the following columns:
  • symbol (str): The symbol of the crypto.

  • name (str): The name of the crypto.

  • price (float): The current price of the crypto.

  • changes_percentage (float): The percentage change in price.

  • change (float): The change in price.

  • day_low (float): The lowest price of the day.

  • day_high (float): The highest price of the day.

  • year_high (float): The highest price in the past year.

  • year_low (float): The lowest price in the past year.

  • market_cap (int): The market capitalization of the crypto.

  • price_avg_50 (float): The 50-day average price.

  • price_avg_200 (float): The 200-day average price.

  • exchange (str): The exchange where the crypto is traded.

  • volume (int): The trading volume of the crypto.

  • avg_volume (int): The average trading volume of the crypto.

  • open (float): The opening price of the crypto.

  • previous_close (float): The previous closing price of the crypto.

  • eps (float): The earnings per share of the crypto.

  • pe (float): The price-to-earnings ratio of the crypto.

  • earnings_announcement (str): The announcement date of the earnings.

  • shares_outstanding (int): The number of shares outstanding.

  • timestamp (datetime): The timestamp of the data.

Return type:

pd.DataFrame

Raises:

ValueError – If no data is found.