Camel.toolkits.openbb toolkit
OpenBBToolkit
A toolkit for accessing financial data and analysis through OpenBB Platform.
This toolkit provides methods for retrieving and analyzing financial market data, including stocks, ETFs, cryptocurrencies, economic indicators, and more through the OpenBB Platform SDK. For credential configuration, please refer to the OpenBB documentation https://my.openbb.co/app/platform/credentials .
init
Initialize the OpenBBToolkit.
This method sets up the OpenBB client and initializes the OpenBB Hub account system.
_handle_api_error
Handle API operation errors consistently.
Parameters:
- error (Exception): The caught exception.
- operation (str): Description of the failed operation (e.g., “get_historical_data”).
- log_level (str): Logging level to use (“warning” or “error”).
- format_args: Additional format arguments for the error message .
Returns:
List: List with error message.
search_equity
Search for equity symbols and company information.
For SEC provider, an empty query ("") returns the complete list of companies sorted by market cap.
Parameters:
- query (str): Search query (company name or symbol), use "" for complete SEC list.
- provider (
Literal["intrinio", "sec"]
): Data provider. Available - options: - sec: SEC EDGAR Database (sorted by market cap) - intrinio: Intrinio Financial Data
Returns:
List: Search results.
search_institution
Search for financial institutions in SEC database.
Parameters:
- query (str): Institution name to search (e.g., “Berkshire Hathaway”).
Returns:
List: Institution search results.
search_filings
Search for SEC filings by CIK or ticker symbol.
Parameters:
- symbol (str): Symbol to get data for (e.g., “MAXD”).
- provider (
Literal["fmp", "intrinio", "sec"]
): Data provider. (default: :obj:sec
) - form_type (Optional[str]): Filter by form type. Check the data provider for available types. Multiple comma separated items allowed for provider(s): sec. (default: :obj:
None
)
Returns:
List: Filing search results.
search_etf
Search for ETF information.
Parameters:
- query (str): Search query (ETF name or symbol).
- provider (
Literal["fmp", "intrinio"]
): Data provider. (default: :obj:fmp
)
Returns:
List: ETF search results.
screen_market
Screen stocks based on market and fundamental criteria.
Parameters:
- provider (
Literal["fmp", "yfinance"]
): Data provider. (default: :obj:fmp
) - country (Optional[str]): Two-letter ISO country code (e.g., ‘US’, ‘IN’, ‘CN’). (default: :obj:
None
) - exchange (Optional[str]): Stock exchange code (e.g., ‘NYSE’, ‘AMEX’, ‘NSE’). (default: :obj:
None
) - sector (Optional[str]): Market sector (e.g., ‘Financial Services’, ‘Healthcare). (default: :obj:
None
) - industry (Optional[str]): Industry within sector (e.g., ‘Banks—Regional’,‘Drug Manufacturers’). (default: :obj:
None
) - mktcap_min (Optional[float]): Minimum market cap in USD. (default: :obj:
None
) - mktcap_max (Optional[float]): Maximum market cap in USD. (default: :obj:
None
) - beta_min (Optional[float]): Minimum beta value. (default: :obj:
None
) - beta_max (Optional[float]): Maximum beta value. (default: :obj:
None
)
Returns:
List: Screened stocks.
get_available_indices
Get list of available market indices.
Parameters:
- provider (
Literal["fmp", "yfinance"]
): Data provider. (default: :obj:fmp
)
Returns:
List: Available indices.
get_stock_quote
Get current stock quote for a given symbol.
Parameters:
- symbol (str): Stock symbol (e.g., ‘AAPL’ for Apple Inc.)
- provider (
Literal["fmp", "intrinio", "yfinance"]
): Data source. (default: :obj:fmp
)
Returns:
List: Stock quote data in requested format
get_historical_data
Retrieves historical market data from OpenBB Platform providers.
Parameters:
- symbol (str): Stock symbol (e.g., ‘AAPL’ for Apple Inc.).
- provider (
Literal["fmp", "polygon", "tiingo", "yfinance"]
): Data source. (default: :obj:fmp
) - asset_type (
Literal["equity", "currency", "crypto"]
): Asset type. (default: :obj:equity
) - start_date: Start date in YYYY-MM-DD format. If None, uses provider’s default lookback. (default: :obj:
None
) - end_date: End date in YYYY-MM-DD format. If None, uses current date. (default: :obj:
None
) - interval: Data frequency/timeframe. (default: :obj:
1d
) (default: 1d)
Returns:
List: Historical market data.
get_market_data
Get market movers data.
Parameters:
- category (
Literal["gainers", "losers", "active"]
): Type of market data. Must be ‘gainers’, ‘losers’, or ‘active’. (default: :obj:active
)
Returns:
List: Market movers data.
get_earnings_calendar
Get company earnings calendar with filtering and sorting options.
Parameters:
- start_date (Optional[str]): Start date in YYYY-MM-DD format. (default: :obj:
None
) - end_date (Optional[str]): End date in YYYY-MM-DD format. (default: :obj:
None
)
Returns:
List: Earnings calendar.
get_dividend_calendar
Get dividend calendar with optional yield calculations.
Parameters:
- start_date (Optional[str]): Start date in YYYY-MM-DD format. (default: :obj:
None
) - end_date (Optional[str]): End date in YYYY-MM-DD format. (default: :obj:
None
)
Returns:
List: Dividend calendar.
get_ipo_calendar
Get IPO/SPO calendar with comprehensive filtering options.
Parameters:
- start_date (Optional[str]): Start date in YYYY-MM-DD format. (default: :obj:
None
) - end_date (Optional[str]): End date in YYYY-MM-DD format. (default: :obj:
None
)
Returns:
List: IPO/SPO calendar.
get_available_indicators
Get list of available economic indicators.
Parameters:
- provider (
Literal["econdb", "imf"]
): Data provider. (default: :obj:econdb
)
Returns:
List: Available indicators.
get_indicator_data
Get detailed metadata for an economic indicator.
Parameters:
- symbol (str): Stock symbol (e.g., ‘AAPL’ for Apple Inc.).
- country (str): Country code (e.g., ‘US’ for United States).
- provider (
Literal["econdb", "imf"]
): Data provider. (default: :obj:econdb
)
Returns:
List: Indicator data.
get_financial_metrics
Get company financial metrics and ratios.
Parameters:
- symbol (str): Stock symbol (e.g., ‘AAPL’ for Apple Inc.).
- provider (
Literal["fmp", "intrinio", "yfinance"]
): Data source. (default: :obj:fmp
) - period (
Literal["annual", "quarter"]
): Reporting period, “annual”: Annual metrics, “quarter”: Quarterly metrics. (default: :obj:annual
) - limit (int): Number of periods to return. (default: :obj:
5
) (default: 5)
Returns:
List: Financial metric.
get_company_profile
Get company profile information.
Parameters:
- symbol (str): Stock symbol (e.g., ‘AAPL’ for Apple Inc.).
- provider (
Literal["fmp", "intrinio", "yfinance"]
): Data provider. (default: :obj:fmp
)
Returns:
List: Company profile.
get_financial_statement
Get company financial statements.
Access balance sheet, income statement, or cash flow statement data. Data availability and field names vary by provider and company type.
Parameters:
- symbol (str): Stock symbol (e.g., ‘AAPL’ for Apple Inc.).
- provider (
Literal["fmp", "intrinio", "polygon", "yfinance"]
): Data provider. (default: :obj:fmp
) - statement_type (
Literal["balance", "income", "cash"]
): Type of financial statement, “balance”: Balance sheet, “income”: Income statement, “cash”: Cash flow statement. (default: :obj:balance
) - period (
Literal["annual", "quarter"]
): Reporting period, “annual”: Annual reports, “quarter”: Quarterly reports. (default: :obj:annual
) - limit (int): Number of periods to return. (default: :obj:
5
) (default: 5)
Returns:
List: Financial statement data.
get_financial_attributes
Get historical values for a specific financial attribute.
Parameters:
- symbol (str): Stock symbol (e.g., ‘AAPL’ for Apple Inc.).
- tag (str): Financial attribute tag (use search_financial_attributes to find tags). frequency (Literal[“daily”, “weekly”, “monthly”, “quarterly”, “yearly”]): Data frequency, “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. (default: :obj:
yearly
)
Returns:
List: Historical values.
search_financial_attributes
Search for available financial attributes/tags.
Parameters:
- query (str): Search term (e.g., “marketcap”, “revenue”, “assets”).
Returns:
List: Matching attributes.
get_economic_calendar
Get economic calendar events.
Parameters:
- provider (
Literal["fmp", "tradingeconomics"]
): Data provider. (default: :obj:fmp
) - start_date (Optional[str]): Start date in YYYY-MM-DD format. (default: :obj:
None
) - end_date (Optional[str]): End date in YYYY-MM-DD format. (default: :obj:
None
)
Returns:
List: Economic calendar.
get_tools
Returns:
List[FunctionTool]: List of available tools.