fmp_py.fmp_quote

Classes

FmpQuote

Module Contents

class fmp_py.fmp_quote.FmpQuote(api_key: str = os.getenv('FMP_API_KEY'))

Bases: fmp_py.fmp_base.FmpBase

fx_prices() pandas.DataFrame

Retrieves foreign exchange prices from the API and returns them as a pandas DataFrame.

Returns:

A DataFrame containing the foreign exchange prices.

Return type:

pd.DataFrame

fx_price(symbol: str) fmp_py.models.quote.FxPrice

Retrieves the foreign exchange price for a given symbol.

Parameters:

symbol (str) – The symbol of the foreign exchange.

Returns:

An instance of the FxPrice class containing the retrieved data.

Return type:

FxPrice

Raises:

ValueError – If there is an error retrieving the data.

all_live_full_stock_prices() pandas.DataFrame

Retrieves all live full stock prices from the API.

Returns:

A DataFrame containing the live full stock prices.

Return type:

pd.DataFrame

live_full_stock_price(symbol: str) fmp_py.models.quote.RealtimeFullPrice

Retrieves the real-time full stock price for a given symbol.

Parameters:

symbol (str) – The stock symbol.

Returns:

An instance of the RealtimeFullPrice class containing the retrieved data.

Return type:

RealtimeFullPrice

Raises:

ValueError – If there is an error retrieving the data.

last_crypto(symbol: str) fmp_py.models.quote.CryptoQuote

Retrieves the last quote for a given cryptocurrency symbol.

Parameters:

symbol (str) – The symbol of the cryptocurrency.

Returns:

An instance of the CryptoQuote class representing the last quote.

Return type:

CryptoQuote

Raises:

ValueError – If there is an error retrieving the data or if no data is found for the symbol.

last_forex(symbol: str) fmp_py.models.quote.ForexQuote

Retrieves the last forex quote for the given symbol.

Parameters:

symbol (str) – The symbol of the forex pair.

Returns:

An instance of the ForexQuote class representing the last forex quote.

Return type:

ForexQuote

Raises:

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

batch_trade(symbols: List[str]) pandas.DataFrame

Retrieves batch pre and post-market trade data for the given symbols.

Parameters:

symbols (List[str]) – A list of symbols for which to retrieve trade data.

Returns:

A DataFrame containing the trade data for the given symbols.

Return type:

pd.DataFrame

Raises:
  • ValueError – If symbols is not a list of symbols.

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

batch_quote(symbols: List[str]) pandas.DataFrame

Retrieves batch pre and post-market quotes for the given symbols.

Parameters:

symbols (List[str]) – A list of symbols for which to retrieve quotes.

Returns:

A DataFrame containing the batch quotes data.

Return type:

pd.DataFrame

Raises:
  • ValueError – If symbols is not a list of symbols.

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

aftermarket_quote(symbol: str) fmp_py.models.quote.AftermarketQuote

Retrieves aftermarket quote data for a given symbol.

Parameters:

symbol (str) – The symbol for which to retrieve the aftermarket quote.

Returns:

An instance of the AftermarketQuote class containing the quote data.

Return type:

AftermarketQuote

Raises:

ValueError – If the symbol is invalid or not found.

aftermarket_trade(symbol: str) fmp_py.models.quote.AftermarketTrade

Retrieves aftermarket trade data for a given symbol.

Parameters:

symbol (str) – The symbol for which to retrieve aftermarket trade data.

Returns:

An instance of the AftermarketTrade class containing the retrieved data.

Return type:

AftermarketTrade

Raises:

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

stock_price_change(symbol: str) fmp_py.models.quote.PriceChange

Retrieves the price change information for a given stock symbol.

Parameters:

symbol (str) – The stock symbol for which to retrieve the price change information.

Returns:

An object containing the price change information for the specified stock symbol.

Return type:

PriceChange

Raises:

ValueError – If no data is found for the specified stock symbol.

exchange_prices(exchange: str) pandas.DataFrame
otc_quote(symbol: str) fmp_py.models.quote.OtcQuote

Retrieves real-time OTC quote for a given symbol.

Parameters:

symbol (str) – The symbol for which to retrieve the quote.

Returns:

An instance of the OtcQuote class containing the quote information.

Return type:

OtcQuote

Raises:

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

simple_quote(symbol: str) fmp_py.models.quote.SimpleQuote

Retrieves a simple quote for the specified symbol.

Parameters:

symbol (str) – The symbol of the stock or security.

Returns:

An instance of the SimpleQuote class containing the symbol, price, and volume.

Return type:

SimpleQuote

Raises:

ValueError – If the symbol is invalid.

quote_order(symbol: str) fmp_py.models.quote.Quote

Retrieves the quote order for a given symbol.

Parameters:

symbol (str) – The symbol for which to retrieve the quote order.

Returns:

The quote order for the specified symbol.

Return type:

Quote

full_quote(symbol: str) fmp_py.models.quote.Quote

Retrieves the full quote for a given symbol.

Parameters:

symbol (str) – The symbol of the stock or security.

Returns:

The full quote information for the specified symbol.

Return type:

Quote

_process_quote(url: str) fmp_py.models.quote.Quote

Process the quote data retrieved from the API response.

Parameters:

url (str) – The URL used to retrieve the quote data.

Returns:

An instance of the Quote class containing the processed quote data.

Return type:

Quote

Raises:

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