fmp_py.fmp_forex
Classes
Module Contents
- class fmp_py.fmp_forex.FmpForex(api_key: str = os.getenv('FMP_API_KEY'))
Bases:
fmp_py.fmp_base.FmpBase- forex_daily(symbol: str) pandas.DataFrame
Retrieves daily forex data for a given symbol. :param symbol: The symbol for the forex pair. :type symbol: str
- Returns:
A DataFrame containing the historical daily forex data.
- Return type:
pd.DataFrame
- Raises:
ValueError – If no data is found for the given symbol.
- intraday_forex_quote(symbol: str, interval: str, from_date: str, to_date: str) pandas.DataFrame
Retrieves intraday forex quotes for a given symbol within a specified time interval. :param symbol: The symbol of the forex 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 forex quotes with the following columns:
date: The date and time of the quote.
open: The opening price of the forex pair.
high: The highest price of the forex pair during the interval.
low: The lowest price of the forex pair during the interval.
close: The closing price of the forex 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_forex_quote(symbol: str) pandas.DataFrame
Retrieves the full forex quote for a given symbol. :param symbol: The symbol for the forex quote. :type symbol: str
- Returns:
A DataFrame containing the full forex quote data.
- Return type:
pd.DataFrame
- Raises:
ValueError – If no data is found for the given symbol.
- forex_list() pandas.DataFrame
Retrieves a list of available forex 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_forex_quote_list() pandas.DataFrame
Retrieves a full list of forex quotes. :returns:
- A DataFrame containing the forex quotes with the following columns:
symbol (str): The symbol of the forex.
name (str): The name of the forex.
price (float): The current price of the forex.
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 forex.
price_avg_50 (float): The 50-day average price.
price_avg_200 (float): The 200-day average price.
exchange (str): The exchange where the forex is traded.
volume (int): The trading volume of the forex.
avg_volume (int): The average trading volume of the forex.
open (float): The opening price of the forex.
previous_close (float): The previous closing price of the forex.
eps (float): The earnings per share of the forex.
pe (float): The price-to-earnings ratio of the forex.
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.