### Install fmp-python SDK Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Install the SDK using pip. Options include installing from PyPI, from source, or with development dependencies. ```bash pip install fmp-python ``` ```bash pip install -e . ``` ```bash pip install -e ".[dev]" ``` -------------------------------- ### Market Data API Methods Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Examples of methods for fetching market data, such as quotes, historical prices, and industry P/E ratios. ```python client.get_quote(symbol) ``` ```python client.get_historical_chart(symbol, interval="5min", from_date="2024-01-01") ``` ```python client.get_historical_price(symbol, timeseries=30) ``` ```python client.get_industry_pe(date="2024-10-01", exchange="NASDAQ") ``` -------------------------------- ### Company Data API Methods Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Examples of methods for retrieving company information, including profiles, stock lists, and screening. ```python client.get_profile(symbol) ``` ```python client.search_symbol(query) ``` ```python client.search_by_cik(cik) ``` ```python client.screen_stocks(sector="Technology", market_cap_more_than=1e9, limit=10) ``` ```python client.get_stock_list() ``` -------------------------------- ### Quick Start: Fetch and Print Financial Data Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Initialize the FMPClient with an API key and fetch various financial data points like company profiles, market quotes, crypto prices, and income statements. Requires setting the FMP_API_KEY environment variable. ```python import os from fmp import FMPClient client = FMPClient(api_key=os.getenv("FMP_API_KEY")) # Company data profile = client.get_profile("AAPL") print(f"{profile[0].company_name}: ${profile[0].price}") # Market data quote = client.get_quote("AAPL") print(f"Volume: {quote[0].volume:,}") # Crypto btc = client.get_crypto_quote("BTCUSD") print(f"Bitcoin: ${btc[0].price:,.2f}") # Financials income = client.get_income_statement("AAPL", period="annual", limit=1) print(f"Revenue: ${income[0].revenue:,.0f}") ``` -------------------------------- ### Financial Statements API Methods Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Examples of methods for accessing financial statements like income, balance sheet, cash flow, and growth metrics. ```python client.get_income_statement(symbol, period="annual", limit=5) ``` ```python client.get_balance_sheet(symbol, period="annual", limit=5) ``` ```python client.get_cash_flow_statement(symbol, period="annual", limit=5) ``` ```python client.get_financial_growth(symbol, period="annual", limit=5) ``` -------------------------------- ### Crypto Data API Methods Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Examples of methods for retrieving cryptocurrency data, including quotes, lists, intraday data, and latest news. ```python client.get_crypto_quote("BTCUSD") ``` ```python client.get_crypto_list() ``` ```python client.get_crypto_intraday("BTCUSD", interval="5min") ``` ```python client.get_crypto_news_latest(limit=10) ``` -------------------------------- ### Error Handling with FMPAPIError and FMPAuthError Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Illustrates how to handle potential API errors, including authentication failures and general API exceptions, using try-except blocks. ```python from fmp import FMPClient, FMPAPIError, FMPAuthError try: profile = client.get_profile("AAPL") except FMPAuthError: print("Invalid API key") except FMPAPIError as e: print(f"API error: {e}") ``` -------------------------------- ### Type Safety with Pydantic Models Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Demonstrates how Pydantic models provide type hints and validation for API responses, enabling IDE autocompletion and type checking. ```python from fmp.models import CompanyProfile, Quote, IncomeStatement profile: list[CompanyProfile] = client.get_profile("AAPL") print(profile[0].company_name) # ✅ IDE autocomplete print(profile[0].market_cap) # ✅ Type checked print(profile[0].sector) # ✅ Validated ``` -------------------------------- ### Cryptocurrency Methods Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Methods for retrieving cryptocurrency data, including quotes, lists, intraday data, and news. ```APIDOC ## Cryptocurrency Methods ### `get_crypto_quote(symbol)` Retrieves the real-time quote for a specified cryptocurrency symbol (e.g., BTCUSD). ### `get_crypto_list()` Retrieves a list of all available cryptocurrencies. ### `get_crypto_intraday(symbol, interval)` Fetches intraday data for a cryptocurrency symbol with a specified interval. ### `get_crypto_news_latest(limit)` Retrieves the latest cryptocurrency news, with an option to limit the number of results. ``` -------------------------------- ### Market Data Methods Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Methods for accessing market data, including real-time quotes, historical prices, and industry performance metrics. ```APIDOC ## Market Data Methods ### `get_quote(symbol)` Retrieves real-time quote data for a given stock symbol. ### `get_historical_chart(symbol, interval, from_date)` Fetches historical chart data for a stock symbol within a specified interval and date range. ### `get_historical_price(symbol, timeseries)` Retrieves historical price data for a stock symbol over a specified number of time series. ### `get_industry_pe(date, exchange)` Retrieves industry Price-to-Earnings (P/E) ratios for a given date and exchange. ``` -------------------------------- ### Financial Statement Methods Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Methods for accessing various financial statements of a company, including income statements, balance sheets, and cash flow statements. ```APIDOC ## Financial Statement Methods ### `get_income_statement(symbol, period, limit)` Retrieves the income statement for a company, with options for period (annual/quarterly) and limit. ### `get_balance_sheet(symbol, period, limit)` Retrieves the balance sheet for a company, with options for period and limit. ### `get_cash_flow_statement(symbol, period, limit)` Retrieves the cash flow statement for a company, with options for period and limit. ### `get_financial_growth(symbol, period, limit)` Retrieves financial growth metrics for a company, with options for period and limit. ``` -------------------------------- ### Company Data Methods Source: https://github.com/enescanguven/fmp-python/blob/main/README.md Methods for retrieving company-specific information, including profiles, search functionalities, and stock listings. ```APIDOC ## Company Data Methods ### `get_profile(symbol)` Retrieves the company profile for a given stock symbol. ### `search_symbol(query)` Searches for stock symbols based on a query string. ### `search_by_cik(cik)` Retrieves company information using the CIK (Central Index Key). ### `screen_stocks(sector, market_cap_more_than, limit)` Screens stocks based on specified criteria like sector and market capitalization. ### `get_stock_list()` Retrieves a list of all available stock symbols. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.