diff --git a/openbb_sdk/extensions/charting/openbb_charting/__init__.py b/openbb_sdk/extensions/charting/openbb_charting/__init__.py index 9d60f0e2e6f..494d7d40b75 100644 --- a/openbb_sdk/extensions/charting/openbb_charting/__init__.py +++ b/openbb_sdk/extensions/charting/openbb_charting/__init__.py @@ -3,4 +3,4 @@ from openbb_charting.core.backend import ( create_backend, get_backend, ) -from openbb_charting.core.to_plotly_json import to_plotly_json +from openbb_charting.core.to_chart import to_chart diff --git a/openbb_sdk/extensions/charting/openbb_charting/builder.py b/openbb_sdk/extensions/charting/openbb_charting/builder.py index 75b5710f8bc..90351e6bd5d 100644 --- a/openbb_sdk/extensions/charting/openbb_charting/builder.py +++ b/openbb_sdk/extensions/charting/openbb_charting/builder.py @@ -1,9 +1,12 @@ from inspect import getmembers, isfunction from typing import List +from openbb_charting import charting_router from openbb_core.app.router import RouterLoader -CHARTING_ROUTER = "./charting_router.py" +# refers to the root of the repo, not the root of the extension +# this script should be run from the root of the repo +CHARTING_ROUTER = "openbb_sdk/extensions/charting/openbb_charting/charting_router.py" def get_routes() -> List[str]: @@ -18,15 +21,13 @@ def create_charting_functions_w_routes(routes_to_add: List[str]): f.write( f""" -def {route}(**kwargs): +def {route}(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `{original_route}` does not have a charting function") """ ) def get_charting_functions() -> List[str]: - from . import charting_router # pylint: disable=import-outside-toplevel - functions = getmembers(charting_router, isfunction) if functions: return [function[0] for function in functions] diff --git a/openbb_sdk/extensions/charting/openbb_charting/charting_router.py b/openbb_sdk/extensions/charting/openbb_charting/charting_router.py index 59f640d8f32..10d1b9fcf1a 100644 --- a/openbb_sdk/extensions/charting/openbb_charting/charting_router.py +++ b/openbb_sdk/extensions/charting/openbb_charting/charting_router.py @@ -1,3 +1,7 @@ +from typing import Any, Dict, Tuple + +from openbb_charting.core.openbb_figure import OpenBBFigure +from openbb_charting.core.openbb_figure_table import OpenBBFigureTable from openbb_charting.core.plotly_ta.ta_class import PlotlyTA from openbb_core.app.model.charts.chart import ChartFormat from openbb_core.app.router import Router @@ -14,1645 +18,1801 @@ CHART_FORMAT = ChartFormat.plotly # pylint: disable=too-many-lines -def crypto_load(**kwargs): +def crypto_load(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `crypto/load` does not have a charting function") -def economy_corecpi(**kwargs): +def economy_corecpi(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/corecpi` does not have a charting function" ) -def economy_cpi(**kwargs): +def economy_cpi(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `economy/cpi` does not have a charting function") -def economy_cpi_options(**kwargs): +def economy_cpi_options(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/cpi/options` does not have a charting function" ) -def economy_index(**kwargs): +def economy_index(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/index` does not have a charting function" ) -def economy_available_indices(**kwargs): +def economy_available_indices(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/available/indices` does not have a charting function" ) -def economy_macro(**kwargs): +def economy_macro(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/macro` does not have a charting function" ) -def economy_macro_countries(**kwargs): +def economy_macro_countries(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/macro/countries` does not have a charting function" ) -def economy_macro_parameters(**kwargs): +def economy_macro_parameters(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/macro/parameters` does not have a charting function" ) -def economy_balance(**kwargs): +def economy_balance(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/balance` does not have a charting function" ) -def economy_bigmac(**kwargs): +def economy_bigmac(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/bigmac` does not have a charting function" ) -def economy_country_codes(**kwargs): +def economy_country_codes(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/country/codes` does not have a charting function" ) -def economy_currencies(**kwargs): +def economy_currencies(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/currencies` does not have a charting function" ) -def economy_debt(**kwargs): +def economy_debt(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/debt` does not have a charting function" ) -def economy_events(**kwargs): +def economy_events(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/events` does not have a charting function" ) -def economy_fgdp(**kwargs): +def economy_fgdp(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/fgdp` does not have a charting function" ) -def economy_fred(**kwargs): +def economy_fred(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/fred` does not have a charting function" ) -def economy_fred_search(**kwargs): +def economy_fred_search(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/fred/search` does not have a charting function" ) -def economy_futures(**kwargs): +def economy_futures(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/futures` does not have a charting function" ) -def economy_gdp(**kwargs): +def economy_gdp(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `economy/gdp` does not have a charting function") -def economy_glbonds(**kwargs): +def economy_glbonds(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/glbonds` does not have a charting function" ) -def economy_indices(**kwargs): +def economy_indices(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/indices` does not have a charting function" ) -def economy_overview(**kwargs): +def economy_overview(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/overview` does not have a charting function" ) -def economy_perfmap(**kwargs): +def economy_perfmap(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/perfmap` does not have a charting function" ) -def economy_performance(**kwargs): +def economy_performance(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/performance` does not have a charting function" ) -def economy_revenue(**kwargs): +def economy_revenue(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/revenue` does not have a charting function" ) -def economy_rgdp(**kwargs): +def economy_rgdp(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/rgdp` does not have a charting function" ) -def economy_rtps(**kwargs): +def economy_rtps(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/rtps` does not have a charting function" ) -def economy_search_index(**kwargs): +def economy_search_index(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/search/index` does not have a charting function" ) -def economy_spending(**kwargs): +def economy_spending(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/spending` does not have a charting function" ) -def economy_trust(**kwargs): +def economy_trust(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/trust` does not have a charting function" ) -def economy_usbonds(**kwargs): +def economy_usbonds(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/usbonds` does not have a charting function" ) -def economy_valuation(**kwargs): +def economy_valuation(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `economy/valuation` does not have a charting function" ) -def fixedincome_treasury(**kwargs): +def fixedincome_treasury(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `fixedincome/treasury` does not have a charting function" ) -def fixedincome_ycrv(**kwargs): +def fixedincome_ycrv(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `fixedincome/ycrv` does not have a charting function" ) -def forex_load(**kwargs): +def forex_load(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `forex/load` does not have a charting function") -def news_globalnews(**kwargs): +def news_globalnews(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `news/globalnews` does not have a charting function" ) -def news_sectornews(**kwargs): +def news_sectornews(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `news/sectornews` does not have a charting function" ) -def providers_benzinga_global_news_standardized(**kwargs): +def providers_benzinga_global_news_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/benzinga/global/news/standardized` does not have a charting function" ) -def providers_benzinga_stock_news_standardized(**kwargs): +def providers_benzinga_stock_news_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/benzinga/stock/news/standardized` does not have a charting function" ) -def providers_fmp_key_executives_standardized(**kwargs): +def providers_fmp_key_executives_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/key/executives/standardized` does not have a charting function" ) -def providers_fmp_stock_eod_standardized(**kwargs): +def providers_fmp_stock_eod_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/eod/standardized` does not have a charting function" ) -def providers_fmp_global_news_standardized(**kwargs): +def providers_fmp_global_news_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/global/news/standardized` does not have a charting function" ) -def providers_fmp_stock_news_standardized(**kwargs): +def providers_fmp_stock_news_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/news/standardized` does not have a charting function" ) -def providers_fmp_income_statement_standardized(**kwargs): +def providers_fmp_income_statement_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/income/statement/standardized` does not have a charting function" ) -def providers_fmp_balance_sheet_standardized(**kwargs): +def providers_fmp_balance_sheet_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/balance/sheet/standardized` does not have a charting function" ) -def providers_fmp_cash_flow_statement_standardized(**kwargs): +def providers_fmp_cash_flow_statement_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/cash/flow/statement/standardized` does not have a charting function" ) -def providers_fmp_share_statistics_standardized(**kwargs): +def providers_fmp_share_statistics_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/share/statistics/standardized` does not have a charting function" ) -def providers_fmp_major_indices_eod_standardized(**kwargs): +def providers_fmp_major_indices_eod_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/major/indices/eod/standardized` does not have a charting function" ) -def providers_fmp_revenue_geographic_standardized(**kwargs): +def providers_fmp_revenue_geographic_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/revenue/geographic/standardized` does not have a charting function" ) -def providers_fmp_revenue_business_line_standardized(**kwargs): +def providers_fmp_revenue_business_line_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/revenue/business/line/standardized` does not have a charting function" ) -def providers_fmp_institutional_ownership_standardized(**kwargs): +def providers_fmp_institutional_ownership_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/institutional/ownership/standardized` does not have a charting function" ) -def providers_fmp_company_overview_standardized(**kwargs): +def providers_fmp_company_overview_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/company/overview/standardized` does not have a charting function" ) -def providers_fmp_stock_insider_trading_standardized(**kwargs): +def providers_fmp_stock_insider_trading_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/insider/trading/standardized` does not have a charting function" ) -def providers_fmp_stock_ownership_standardized(**kwargs): +def providers_fmp_stock_ownership_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/ownership/standardized` does not have a charting function" ) -def providers_fmp_e_s_g_score_standardized(**kwargs): +def providers_fmp_e_s_g_score_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/e/s/g/score/standardized` does not have a charting function" ) -def providers_fmp_e_s_g_sector_standardized(**kwargs): +def providers_fmp_e_s_g_sector_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/e/s/g/sector/standardized` does not have a charting function" ) -def providers_fmp_e_s_g_risk_rating_standardized(**kwargs): +def providers_fmp_e_s_g_risk_rating_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/e/s/g/risk/rating/standardized` does not have a charting function" ) -def providers_fmp_stock_price_standardized(**kwargs): +def providers_fmp_stock_price_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/price/standardized` does not have a charting function" ) -def providers_fmp_price_target_consensus_standardized(**kwargs): +def providers_fmp_price_target_consensus_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/price/target/consensus/standardized` does not have a charting function" ) -def providers_fmp_price_target_standardized(**kwargs): +def providers_fmp_price_target_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/price/target/standardized` does not have a charting function" ) -def providers_fmp_analyst_estimates_standardized(**kwargs): +def providers_fmp_analyst_estimates_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/analyst/estimates/standardized` does not have a charting function" ) -def providers_fmp_earnings_calendar_standardized(**kwargs): +def providers_fmp_earnings_calendar_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/earnings/calendar/standardized` does not have a charting function" ) -def providers_fmp_earnings_call_transcript_standardized(**kwargs): +def providers_fmp_earnings_call_transcript_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/earnings/call/transcript/standardized` does not have a charting function" ) -def providers_fmp_historical_stock_splits_standardized(**kwargs): +def providers_fmp_historical_stock_splits_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/historical/stock/splits/standardized` does not have a charting function" ) -def providers_fmp_historical_dividends_standardized(**kwargs): +def providers_fmp_historical_dividends_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/historical/dividends/standardized` does not have a charting function" ) -def providers_fmp_key_metrics_standardized(**kwargs): +def providers_fmp_key_metrics_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/key/metrics/standardized` does not have a charting function" ) -def providers_fmp_s_e_c_filings_standardized(**kwargs): +def providers_fmp_s_e_c_filings_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/s/e/c/filings/standardized` does not have a charting function" ) -def providers_fmp_treasury_rates_standardized(**kwargs): +def providers_fmp_treasury_rates_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/treasury/rates/standardized` does not have a charting function" ) -def providers_fmp_executive_compensation_standardized(**kwargs): +def providers_fmp_executive_compensation_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/executive/compensation/standardized` does not have a charting function" ) -def providers_fmp_crypto_price_standardized(**kwargs): +def providers_fmp_crypto_price_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/crypto/price/standardized` does not have a charting function" ) -def providers_fmp_crypto_eod_standardized(**kwargs): +def providers_fmp_crypto_eod_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/crypto/eod/standardized` does not have a charting function" ) -def providers_fmp_major_indices_price_standardized(**kwargs): +def providers_fmp_major_indices_price_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/major/indices/price/standardized` does not have a charting function" ) -def providers_fmp_forex_eod_standardized(**kwargs): +def providers_fmp_forex_eod_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/forex/eod/standardized` does not have a charting function" ) -def providers_polygon_stock_eod_standardized(**kwargs): +def providers_polygon_stock_eod_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/stock/eod/standardized` does not have a charting function" ) -def providers_polygon_stock_news_standardized(**kwargs): +def providers_polygon_stock_news_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/stock/news/standardized` does not have a charting function" ) -def providers_polygon_balance_sheet_standardized(**kwargs): +def providers_polygon_balance_sheet_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/balance/sheet/standardized` does not have a charting function" ) -def providers_polygon_income_statement_standardized(**kwargs): +def providers_polygon_income_statement_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/income/statement/standardized` does not have a charting function" ) -def providers_polygon_cash_flow_statement_standardized(**kwargs): +def providers_polygon_cash_flow_statement_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/cash/flow/statement/standardized` does not have a charting function" ) -def providers_polygon_stock_price_standardized(**kwargs): +def providers_polygon_stock_price_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/stock/price/standardized` does not have a charting function" ) -def providers_polygon_crypto_price_standardized(**kwargs): +def providers_polygon_crypto_price_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/crypto/price/standardized` does not have a charting function" ) -def providers_polygon_crypto_eod_standardized(**kwargs): +def providers_polygon_crypto_eod_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/crypto/eod/standardized` does not have a charting function" ) -def providers_polygon_major_indices_eod_standardized(**kwargs): +def providers_polygon_major_indices_eod_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/major/indices/eod/standardized` does not have a charting function" ) -def providers_polygon_major_indices_price_standardized(**kwargs): +def providers_polygon_major_indices_price_standardized( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/major/indices/price/standardized` does not have a charting function" ) -def providers_benzinga_global_news_simple(**kwargs): +def providers_benzinga_global_news_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/benzinga/global/news/simple` does not have a charting function" ) -def providers_benzinga_stock_news_simple(**kwargs): +def providers_benzinga_stock_news_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/benzinga/stock/news/simple` does not have a charting function" ) -def providers_fmp_key_executives_simple(**kwargs): +def providers_fmp_key_executives_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/key/executives/simple` does not have a charting function" ) -def providers_fmp_stock_eod_simple(**kwargs): +def providers_fmp_stock_eod_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/eod/simple` does not have a charting function" ) -def providers_fmp_global_news_simple(**kwargs): +def providers_fmp_global_news_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/global/news/simple` does not have a charting function" ) -def providers_fmp_stock_news_simple(**kwargs): +def providers_fmp_stock_news_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/news/simple` does not have a charting function" ) -def providers_fmp_income_statement_simple(**kwargs): +def providers_fmp_income_statement_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/income/statement/simple` does not have a charting function" ) -def providers_fmp_balance_sheet_simple(**kwargs): +def providers_fmp_balance_sheet_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/balance/sheet/simple` does not have a charting function" ) -def providers_fmp_cash_flow_statement_simple(**kwargs): +def providers_fmp_cash_flow_statement_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/cash/flow/statement/simple` does not have a charting function" ) -def providers_fmp_share_statistics_simple(**kwargs): +def providers_fmp_share_statistics_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/share/statistics/simple` does not have a charting function" ) -def providers_fmp_major_indices_eod_simple(**kwargs): +def providers_fmp_major_indices_eod_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/major/indices/eod/simple` does not have a charting function" ) -def providers_fmp_revenue_geographic_simple(**kwargs): +def providers_fmp_revenue_geographic_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/revenue/geographic/simple` does not have a charting function" ) -def providers_fmp_revenue_business_line_simple(**kwargs): +def providers_fmp_revenue_business_line_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/revenue/business/line/simple` does not have a charting function" ) -def providers_fmp_institutional_ownership_simple(**kwargs): +def providers_fmp_institutional_ownership_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/institutional/ownership/simple` does not have a charting function" ) -def providers_fmp_company_overview_simple(**kwargs): +def providers_fmp_company_overview_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/company/overview/simple` does not have a charting function" ) -def providers_fmp_stock_insider_trading_simple(**kwargs): +def providers_fmp_stock_insider_trading_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/insider/trading/simple` does not have a charting function" ) -def providers_fmp_stock_ownership_simple(**kwargs): +def providers_fmp_stock_ownership_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/ownership/simple` does not have a charting function" ) -def providers_fmp_e_s_g_score_simple(**kwargs): +def providers_fmp_e_s_g_score_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/e/s/g/score/simple` does not have a charting function" ) -def providers_fmp_e_s_g_sector_simple(**kwargs): +def providers_fmp_e_s_g_sector_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/e/s/g/sector/simple` does not have a charting function" ) -def providers_fmp_e_s_g_risk_rating_simple(**kwargs): +def providers_fmp_e_s_g_risk_rating_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/e/s/g/risk/rating/simple` does not have a charting function" ) -def providers_fmp_stock_price_simple(**kwargs): +def providers_fmp_stock_price_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/stock/price/simple` does not have a charting function" ) -def providers_fmp_price_target_consensus_simple(**kwargs): +def providers_fmp_price_target_consensus_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/price/target/consensus/simple` does not have a charting function" ) -def providers_fmp_price_target_simple(**kwargs): +def providers_fmp_price_target_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/price/target/simple` does not have a charting function" ) -def providers_fmp_analyst_estimates_simple(**kwargs): +def providers_fmp_analyst_estimates_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/analyst/estimates/simple` does not have a charting function" ) -def providers_fmp_earnings_calendar_simple(**kwargs): +def providers_fmp_earnings_calendar_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/earnings/calendar/simple` does not have a charting function" ) -def providers_fmp_earnings_call_transcript_simple(**kwargs): +def providers_fmp_earnings_call_transcript_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/earnings/call/transcript/simple` does not have a charting function" ) -def providers_fmp_historical_stock_splits_simple(**kwargs): +def providers_fmp_historical_stock_splits_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/historical/stock/splits/simple` does not have a charting function" ) -def providers_fmp_historical_dividends_simple(**kwargs): +def providers_fmp_historical_dividends_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/historical/dividends/simple` does not have a charting function" ) -def providers_fmp_key_metrics_simple(**kwargs): +def providers_fmp_key_metrics_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/key/metrics/simple` does not have a charting function" ) -def providers_fmp_s_e_c_filings_simple(**kwargs): +def providers_fmp_s_e_c_filings_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/s/e/c/filings/simple` does not have a charting function" ) -def providers_fmp_treasury_rates_simple(**kwargs): +def providers_fmp_treasury_rates_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/treasury/rates/simple` does not have a charting function" ) -def providers_fmp_executive_compensation_simple(**kwargs): +def providers_fmp_executive_compensation_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/executive/compensation/simple` does not have a charting function" ) -def providers_fmp_crypto_price_simple(**kwargs): +def providers_fmp_crypto_price_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/crypto/price/simple` does not have a charting function" ) -def providers_fmp_crypto_eod_simple(**kwargs): +def providers_fmp_crypto_eod_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/crypto/eod/simple` does not have a charting function" ) -def providers_fmp_major_indices_price_simple(**kwargs): +def providers_fmp_major_indices_price_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/major/indices/price/simple` does not have a charting function" ) -def providers_fmp_forex_eod_simple(**kwargs): +def providers_fmp_forex_eod_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/fmp/forex/eod/simple` does not have a charting function" ) -def providers_polygon_stock_eod_simple(**kwargs): +def providers_polygon_stock_eod_simple(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/stock/eod/simple` does not have a charting function" ) -def providers_polygon_stock_news_simple(**kwargs): +def providers_polygon_stock_news_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/stock/news/simple` does not have a charting function" ) -def providers_polygon_balance_sheet_simple(**kwargs): +def providers_polygon_balance_sheet_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/balance/sheet/simple` does not have a charting function" ) -def providers_polygon_income_statement_simple(**kwargs): +def providers_polygon_income_statement_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/income/statement/simple` does not have a charting function" ) -def providers_polygon_cash_flow_statement_simple(**kwargs): +def providers_polygon_cash_flow_statement_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/cash/flow/statement/simple` does not have a charting function" ) -def providers_polygon_stock_price_simple(**kwargs): +def providers_polygon_stock_price_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/stock/price/simple` does not have a charting function" ) -def providers_polygon_crypto_price_simple(**kwargs): +def providers_polygon_crypto_price_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/crypto/price/simple` does not have a charting function" ) -def providers_polygon_crypto_eod_simple(**kwargs): +def providers_polygon_crypto_eod_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/crypto/eod/simple` does not have a charting function" ) -def providers_polygon_major_indices_eod_simple(**kwargs): +def providers_polygon_major_indices_eod_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/major/indices/eod/simple` does not have a charting function" ) -def providers_polygon_major_indices_price_simple(**kwargs): +def providers_polygon_major_indices_price_simple( + **kwargs, +) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `providers/polygon/major/indices/price/simple` does not have a charting function" ) -def qa_normality(**kwargs): +def qa_normality(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `qa/normality` does not have a charting function" ) -def qa_capm(**kwargs): +def qa_capm(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/capm` does not have a charting function") -def qa_qqplot(**kwargs): +def qa_qqplot(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/qqplot` does not have a charting function") -def qa_om(**kwargs): +def qa_om(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/om` does not have a charting function") -def qa_kurtosis(**kwargs): +def qa_kurtosis(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/kurtosis` does not have a charting function") -def qa_pick(**kwargs): +def qa_pick(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/pick` does not have a charting function") -def qa_spread(**kwargs): +def qa_spread(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/spread` does not have a charting function") -def qa_rolling(**kwargs): +def qa_rolling(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/rolling` does not have a charting function") -def qa_var(**kwargs): +def qa_var(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/var` does not have a charting function") -def qa_line(**kwargs): +def qa_line(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/line` does not have a charting function") -def qa_hist(**kwargs): +def qa_hist(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/hist` does not have a charting function") -def qa_unitroot(**kwargs): +def qa_unitroot(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/unitroot` does not have a charting function") -def qa_beta(**kwargs): +def qa_beta(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/beta` does not have a charting function") -def qa_sh(**kwargs): +def qa_sh(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/sh` does not have a charting function") -def qa_so(**kwargs): +def qa_so(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/so` does not have a charting function") -def qa_cusum(**kwargs): +def qa_cusum(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/cusum` does not have a charting function") -def qa_raw(**kwargs): +def qa_raw(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/raw` does not have a charting function") -def qa_cdf(**kwargs): +def qa_cdf(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/cdf` does not have a charting function") -def qa_decompose(**kwargs): +def qa_decompose(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `qa/decompose` does not have a charting function" ) -def qa_skew(**kwargs): +def qa_skew(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/skew` does not have a charting function") -def qa_quantile(**kwargs): +def qa_quantile(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/quantile` does not have a charting function") -def qa_bw(**kwargs): +def qa_bw(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/bw` does not have a charting function") -def qa_es(**kwargs): +def qa_es(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/es` does not have a charting function") -def qa_acf(**kwargs): +def qa_acf(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/acf` does not have a charting function") -def qa_summary(**kwargs): +def qa_summary(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `qa/summary` does not have a charting function") -def stocks_fa_balance(**kwargs): +def stocks_fa_balance(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/balance` does not have a charting function" ) -def stocks_fa_cash(**kwargs): +def stocks_fa_cash(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/cash` does not have a charting function" ) -def stocks_fa_comp(**kwargs): +def stocks_fa_comp(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/comp` does not have a charting function" ) -def stocks_fa_earning(**kwargs): +def stocks_fa_earning(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/earning` does not have a charting function" ) -def stocks_fa_emp(**kwargs): +def stocks_fa_emp(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/emp` does not have a charting function" ) -def stocks_fa_est(**kwargs): +def stocks_fa_est(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/est` does not have a charting function" ) -def stocks_fa_income(**kwargs): +def stocks_fa_income(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/income` does not have a charting function" ) -def stocks_fa_ins(**kwargs): +def stocks_fa_ins(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/ins` does not have a charting function" ) -def stocks_fa_metrics(**kwargs): +def stocks_fa_metrics(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/metrics` does not have a charting function" ) -def stocks_fa_mgmt(**kwargs): +def stocks_fa_mgmt(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/mgmt` does not have a charting function" ) -def stocks_fa_overview(**kwargs): +def stocks_fa_overview(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/overview` does not have a charting function" ) -def stocks_fa_own(**kwargs): +def stocks_fa_own(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/own` does not have a charting function" ) -def stocks_fa_pta(**kwargs): +def stocks_fa_pta(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/pta` does not have a charting function" ) -def stocks_fa_pt(**kwargs): +def stocks_fa_pt(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/pt` does not have a charting function" ) -def stocks_fa_revgeo(**kwargs): +def stocks_fa_revgeo(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/revgeo` does not have a charting function" ) -def stocks_fa_revseg(**kwargs): +def stocks_fa_revseg(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/revseg` does not have a charting function" ) -def stocks_fa_shrs(**kwargs): +def stocks_fa_shrs(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/shrs` does not have a charting function" ) -def stocks_fa_shares(**kwargs): +def stocks_fa_shares(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/shares` does not have a charting function" ) -def stocks_fa_transcript(**kwargs): +def stocks_fa_transcript(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/transcript` does not have a charting function" ) -def stocks_fa_split(**kwargs): +def stocks_fa_split(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/split` does not have a charting function" ) -def stocks_fa_cal(**kwargs): +def stocks_fa_cal(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/cal` does not have a charting function" ) -def stocks_fa_customer(**kwargs): +def stocks_fa_customer(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/customer` does not have a charting function" ) -def stocks_fa_divs(**kwargs): +def stocks_fa_divs(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/divs` does not have a charting function" ) -def stocks_fa_dcfc(**kwargs): +def stocks_fa_dcfc(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/dcfc` does not have a charting function" ) -def stocks_fa_dupont(**kwargs): +def stocks_fa_dupont(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/dupont` does not have a charting function" ) -def stocks_fa_enterprise(**kwargs): +def stocks_fa_enterprise(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/enterprise` does not have a charting function" ) -def stocks_fa_epsfc(**kwargs): +def stocks_fa_epsfc(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/epsfc` does not have a charting function" ) -def stocks_fa_analysis(**kwargs): +def stocks_fa_analysis(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/analysis` does not have a charting function" ) -def stocks_fa_fama_coe(**kwargs): +def stocks_fa_fama_coe(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/fama/coe` does not have a charting function" ) -def stocks_fa_fama_raw(**kwargs): +def stocks_fa_fama_raw(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/fama/raw` does not have a charting function" ) -def stocks_fa_fraud(**kwargs): +def stocks_fa_fraud(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/fraud` does not have a charting function" ) -def stocks_fa_growth(**kwargs): +def stocks_fa_growth(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/growth` does not have a charting function" ) -def stocks_fa_historical_5(**kwargs): +def stocks_fa_historical_5(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/historical/5` does not have a charting function" ) -def stocks_fa_key(**kwargs): +def stocks_fa_key(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/key` does not have a charting function" ) -def stocks_fa_mktcap(**kwargs): +def stocks_fa_mktcap(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/mktcap` does not have a charting function" ) -def stocks_fa_news(**kwargs): +def stocks_fa_news(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/news` does not have a charting function" ) -def stocks_fa_rating(**kwargs): +def stocks_fa_rating(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/rating` does not have a charting function" ) -def stocks_fa_ratios(**kwargs): +def stocks_fa_ratios(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/ratios` does not have a charting function" ) -def stocks_fa_revfc(**kwargs): +def stocks_fa_revfc(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/revfc` does not have a charting function" ) -def stocks_fa_rot(**kwargs): +def stocks_fa_rot(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/rot` does not have a charting function" ) -def stocks_fa_score(**kwargs): +def stocks_fa_score(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/score` does not have a charting function" ) -def stocks_fa_sec(**kwargs): +def stocks_fa_sec(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/sec` does not have a charting function" ) -def stocks_fa_supplier(**kwargs): +def stocks_fa_supplier(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/fa/supplier` does not have a charting function" ) -def stocks_ca_get(**kwargs): +def stocks_ca_get(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/get` does not have a charting function" ) -def stocks_ca_balance(**kwargs): +def stocks_ca_balance(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/balance` does not have a charting function" ) -def stocks_ca_cashflow(**kwargs): +def stocks_ca_cashflow(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/cashflow` does not have a charting function" ) -def stocks_ca_hcorr(**kwargs): +def stocks_ca_hcorr(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/hcorr` does not have a charting function" ) -def stocks_ca_hist(**kwargs): +def stocks_ca_hist(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/hist` does not have a charting function" ) -def stocks_ca_income(**kwargs): +def stocks_ca_income(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/income` does not have a charting function" ) -def stocks_ca_scorr(**kwargs): +def stocks_ca_scorr(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/scorr` does not have a charting function" ) -def stocks_ca_screener(**kwargs): +def stocks_ca_screener(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/screener` does not have a charting function" ) -def stocks_ca_sentiment(**kwargs): +def stocks_ca_sentiment(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/sentiment` does not have a charting function" ) -def stocks_ca_similar(**kwargs): +def stocks_ca_similar(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/similar` does not have a charting function" ) -def stocks_ca_volume(**kwargs): +def stocks_ca_volume(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ca/volume` does not have a charting function" ) -def stocks_dd_sec(**kwargs): +def stocks_dd_sec(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dd/sec` does not have a charting function" ) -def stocks_dps_psi(**kwargs): +def stocks_dps_psi(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/psi` does not have a charting function" ) -def stocks_dps_ctb(**kwargs): +def stocks_dps_ctb(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/ctb` does not have a charting function" ) -def stocks_dps_dpotc(**kwargs): +def stocks_dps_dpotc(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/dpotc` does not have a charting function" ) -def stocks_dps_ftd(**kwargs): +def stocks_dps_ftd(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/ftd` does not have a charting function" ) -def stocks_dps_hsi(**kwargs): +def stocks_dps_hsi(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/hsi` does not have a charting function" ) -def stocks_dps_pos(**kwargs): +def stocks_dps_pos(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/pos` does not have a charting function" ) -def stocks_dps_prom(**kwargs): +def stocks_dps_prom(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/prom` does not have a charting function" ) -def stocks_dps_psi_q(**kwargs): +def stocks_dps_psi_q(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/psi/q` does not have a charting function" ) -def stocks_dps_psi_sg(**kwargs): +def stocks_dps_psi_sg(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/psi/sg` does not have a charting function" ) -def stocks_dps_shorted(**kwargs): +def stocks_dps_shorted(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/shorted` does not have a charting function" ) -def stocks_dps_sidtc(**kwargs): +def stocks_dps_sidtc(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/sidtc` does not have a charting function" ) -def stocks_dps_spos(**kwargs): +def stocks_dps_spos(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/dps/spos` does not have a charting function" ) -def stocks_disc_active(**kwargs): +def stocks_disc_active(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/active` does not have a charting function" ) -def stocks_disc_arkord(**kwargs): +def stocks_disc_arkord(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/arkord` does not have a charting function" ) -def stocks_disc_asc(**kwargs): +def stocks_disc_asc(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/asc` does not have a charting function" ) -def stocks_disc_dividends(**kwargs): +def stocks_disc_dividends(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/dividends` does not have a charting function" ) -def stocks_disc_filings(**kwargs): +def stocks_disc_filings(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/filings` does not have a charting function" ) -def stocks_disc_fipo(**kwargs): +def stocks_disc_fipo(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/fipo` does not have a charting function" ) -def stocks_disc_gainers(**kwargs): +def stocks_disc_gainers(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/gainers` does not have a charting function" ) -def stocks_disc_gtech(**kwargs): +def stocks_disc_gtech(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/gtech` does not have a charting function" ) -def stocks_disc_hotpenny(**kwargs): +def stocks_disc_hotpenny(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/hotpenny` does not have a charting function" ) -def stocks_disc_ipo(**kwargs): +def stocks_disc_ipo(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/ipo` does not have a charting function" ) -def stocks_disc_losers(**kwargs): +def stocks_disc_losers(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/losers` does not have a charting function" ) -def stocks_disc_lowfloat(**kwargs): +def stocks_disc_lowfloat(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/lowfloat` does not have a charting function" ) -def stocks_disc_pipo(**kwargs): +def stocks_disc_pipo(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/pipo` does not have a charting function" ) -def stocks_disc_rtat(**kwargs): +def stocks_disc_rtat(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/rtat` does not have a charting function" ) -def stocks_disc_trending(**kwargs): +def stocks_disc_trending(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/trending` does not have a charting function" ) -def stocks_disc_ugs(**kwargs): +def stocks_disc_ugs(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/ugs` does not have a charting function" ) -def stocks_disc_ulc(**kwargs): +def stocks_disc_ulc(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/ulc` does not have a charting function" ) -def stocks_disc_upcoming(**kwargs): +def stocks_disc_upcoming(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/disc/upcoming` does not have a charting function" ) -def stocks_gov_contracts(**kwargs): +def stocks_gov_contracts(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/contracts` does not have a charting function" ) -def stocks_gov_government_trading(**kwargs): +def stocks_gov_government_trading(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/government/trading` does not have a charting function" ) -def stocks_gov_gtrades(**kwargs): +def stocks_gov_gtrades(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/gtrades` does not have a charting function" ) -def stocks_gov_histcont(**kwargs): +def stocks_gov_histcont(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/histcont` does not have a charting function" ) -def stocks_gov_lastcontracts(**kwargs): +def stocks_gov_lastcontracts(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/lastcontracts` does not have a charting function" ) -def stocks_gov_lasttrades(**kwargs): +def stocks_gov_lasttrades(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/lasttrades` does not have a charting function" ) -def stocks_gov_lobbying(**kwargs): +def stocks_gov_lobbying(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/lobbying` does not have a charting function" ) -def stocks_gov_qtrcontracts(**kwargs): +def stocks_gov_qtrcontracts(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/qtrcontracts` does not have a charting function" ) -def stocks_gov_topbuys(**kwargs): +def stocks_gov_topbuys(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/topbuys` does not have a charting function" ) -def stocks_gov_toplobbying(**kwargs): +def stocks_gov_toplobbying(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/toplobbying` does not have a charting function" ) -def stocks_gov_topsells(**kwargs): +def stocks_gov_topsells(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/gov/topsells` does not have a charting function" ) -def stocks_ins_act(**kwargs): +def stocks_ins_act(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/act` does not have a charting function" ) -def stocks_ins_blcp(**kwargs): +def stocks_ins_blcp(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/blcp` does not have a charting function" ) -def stocks_ins_blcs(**kwargs): +def stocks_ins_blcs(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/blcs` does not have a charting function" ) -def stocks_ins_blip(**kwargs): +def stocks_ins_blip(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/blip` does not have a charting function" ) -def stocks_ins_blis(**kwargs): +def stocks_ins_blis(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/blis` does not have a charting function" ) -def stocks_ins_blop(**kwargs): +def stocks_ins_blop(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/blop` does not have a charting function" ) -def stocks_ins_blos(**kwargs): +def stocks_ins_blos(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/blos` does not have a charting function" ) -def stocks_ins_filter(**kwargs): +def stocks_ins_filter(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/filter` does not have a charting function" ) -def stocks_ins_lcb(**kwargs): +def stocks_ins_lcb(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/lcb` does not have a charting function" ) -def stocks_ins_lins(**kwargs): +def stocks_ins_lins(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/lins` does not have a charting function" ) -def stocks_ins_lip(**kwargs): +def stocks_ins_lip(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/lip` does not have a charting function" ) -def stocks_ins_lis(**kwargs): +def stocks_ins_lis(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/lis` does not have a charting function" ) -def stocks_ins_lit(**kwargs): +def stocks_ins_lit(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/lit` does not have a charting function" ) -def stocks_ins_lpsb(**kwargs): +def stocks_ins_lpsb(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/lpsb` does not have a charting function" ) -def stocks_ins_print_insider_data(**kwargs): +def stocks_ins_print_insider_data(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/print/insider/data` does not have a charting function" ) -def stocks_ins_stats(**kwargs): +def stocks_ins_stats(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/ins/stats` does not have a charting function" ) -def stocks_options_chains(**kwargs): +def stocks_options_chains(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/chains` does not have a charting function" ) -def stocks_options_dte(**kwargs): +def stocks_options_dte(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/dte` does not have a charting function" ) -def stocks_options_eodchain(**kwargs): +def stocks_options_eodchain(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/eodchain` does not have a charting function" ) -def stocks_options_expirations(**kwargs): +def stocks_options_expirations(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/expirations` does not have a charting function" ) -def stocks_options_grhist(**kwargs): +def stocks_options_grhist(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/grhist` does not have a charting function" ) -def stocks_options_hist(**kwargs): +def stocks_options_hist(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/hist` does not have a charting function" ) -def stocks_options_info(**kwargs): +def stocks_options_info(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/info` does not have a charting function" ) -def stocks_options_last_price(**kwargs): +def stocks_options_last_price(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/last/price` does not have a charting function" ) -def stocks_options_oi(**kwargs): +def stocks_options_oi(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/oi` does not have a charting function" ) -def stocks_options_pcr(**kwargs): +def stocks_options_pcr(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/pcr` does not have a charting function" ) -def stocks_options_price(**kwargs): +def stocks_options_price(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/price` does not have a charting function" ) -def stocks_options_unu(**kwargs): +def stocks_options_unu(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/unu` does not have a charting function" ) -def stocks_options_voi(**kwargs): +def stocks_options_voi(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/voi` does not have a charting function" ) -def stocks_options_vol(**kwargs): +def stocks_options_vol(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/vol` does not have a charting function" ) -def stocks_options_vsurf(**kwargs): +def stocks_options_vsurf(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/options/vsurf` does not have a charting function" ) -def stocks_load(**kwargs): +def stocks_load(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: def handle_indicators(ma): k = {} if ma: @@ -1674,25 +1834,35 @@ def stocks_load(**kwargs): symbol=f"{symbol} historical data", prepost=prepost, ) + content = fig.show(external=True).to_plotly_json() - return fig.show(external=True).to_plotly_json() + return fig, content -def stocks_news(**kwargs): - raise NotImplementedError("Command `stocks/news` does not have a charting function") +def stocks_news(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: + data = basemodel_to_df( + kwargs["command_output_item"], index=kwargs.get("index", "date") + ) + standard_params = kwargs["standard_params"].__dict__ + columnwidth = standard_params.get("columnwidth", None) + + tbl_fig = OpenBBFigureTable(tabular_data=data, columnwidth=columnwidth) + content = tbl_fig.to_table().show(external=True).to_plotly_json() + + return tbl_fig, content -def stocks_tob(**kwargs): +def stocks_tob(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `stocks/tob` does not have a charting function") -def stocks_quote(**kwargs): +def stocks_quote(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/quote` does not have a charting function" ) -def stocks_search(**kwargs): +def stocks_search(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError( "Command `stocks/search` does not have a charting function" ) @@ -1700,7 +1870,7 @@ def stocks_search(**kwargs): def _ta_ma(ma_type: str, **kwargs): data = basemodel_to_df(kwargs["data"], index=kwargs.get("index", "date")) - window = kwargs.get("window", 50) + window = kwargs.get("windowstocks_load", 50) offset = kwargs.get("offset", 0) symbol = kwargs.get("symbol", "") @@ -1712,48 +1882,49 @@ def _ta_ma(ma_type: str, **kwargs): False, volume=False, ) + content = fig.show(external=True).to_plotly_json() - return fig.show(external=True).to_plotly_json() + return fig, content -def ta_atr(**kwargs): +def ta_atr(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/atr` does not have a charting function") -def ta_fib(**kwargs): +def ta_fib(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/fib` does not have a charting function") -def ta_obv(**kwargs): +def ta_obv(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/obv` does not have a charting function") -def ta_fisher(**kwargs): +def ta_fisher(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/fisher` does not have a charting function") -def ta_adosc(**kwargs): +def ta_adosc(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/adosc` does not have a charting function") -def ta_tv(**kwargs): +def ta_tv(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/tv` does not have a charting function") -def ta_bbands(**kwargs): +def ta_bbands(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/bbands` does not have a charting function") -def ta_multi(**kwargs): +def ta_multi(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/multi` does not have a charting function") -def ta_zlma(**kwargs): +def ta_zlma(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: ma_type = "zlma" return _ta_ma(ma_type, **kwargs) -def ta_aroon(**kwargs): +def ta_aroon(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: data = basemodel_to_df(kwargs["data"], index=kwargs.get("index", "date")) length = kwargs.get("length", 25) scalar = kwargs.get("scalar", 100) @@ -1767,28 +1938,29 @@ def ta_aroon(**kwargs): False, volume=False, ) + content = fig.show(external=True).to_plotly_json() - return fig.show(external=True).to_plotly_json() + return fig, content -def ta_sma(**kwargs): +def ta_sma(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: ma_type = "sma" return _ta_ma(ma_type, **kwargs) -def ta_demark(**kwargs): +def ta_demark(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/demark` does not have a charting function") -def ta_vwap(**kwargs): +def ta_vwap(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/vwap` does not have a charting function") -def ta_recom(**kwargs): +def ta_recom(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/recom` does not have a charting function") -def ta_macd(**kwargs): +def ta_macd(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: data = basemodel_to_df(kwargs["data"], index=kwargs.get("index", "date")) fast = kwargs.get("fast", 12) slow = kwargs.get("slow", 26) @@ -1803,32 +1975,33 @@ def ta_macd(**kwargs): False, volume=False, ) + content = fig.show(external=True).to_plotly_json() - return fig.show(external=True).to_plotly_json() + return fig, content -def ta_hma(**kwargs): +def ta_hma(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: ma_type = "hma" return _ta_ma(ma_type, **kwargs) -def ta_donchian(**kwargs): +def ta_donchian(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/donchian` does not have a charting function") -def ta_ichimoku(**kwargs): +def ta_ichimoku(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/ichimoku` does not have a charting function") -def ta_clenow(**kwargs): +def ta_clenow(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/clenow` does not have a charting function") -def ta_ad(**kwargs): +def ta_ad(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/ad` does not have a charting function") -def ta_adx(**kwargs): +def ta_adx(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: data = basemodel_to_df(kwargs["data"], index=kwargs.get("index", "date")) length = kwargs.get("length", 14) scalar = kwargs.get("scalar", 100.0) @@ -1843,20 +2016,21 @@ def ta_adx(**kwargs): False, volume=False, ) + content = fig.show(external=True).to_plotly_json() - return fig.show(external=True).to_plotly_json() + return fig, content -def ta_wma(**kwargs): +def ta_wma(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: ma_type = "wma" return _ta_ma(ma_type, **kwargs) -def ta_cci(**kwargs): +def ta_cci(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/cci` does not have a charting function") -def ta_rsi(**kwargs): +def ta_rsi(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: data = basemodel_to_df(kwargs["data"], index=kwargs.get("index", "date")) window = kwargs.get("window", 14) scalar = kwargs.get("scalar", 100.0) @@ -1871,34 +2045,76 @@ def ta_rsi(**kwargs): False, volume=False, ) + content = fig.show(external=True).to_plotly_json() - return fig.show(external=True).to_plotly_json() + return fig, content -def ta_summary(**kwargs): +def ta_summary(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/summary` does not have a charting function") -def ta_stoch(**kwargs): +def ta_stoch(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/stoch` does not have a charting function") -def ta_rsp(**kwargs): +def ta_rsp(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/rsp` does not have a charting function") -def ta_kc(**kwargs): +def ta_kc(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/kc` does not have a charting function") -def ta_cg(**kwargs): +def ta_cg(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/cg` does not have a charting function") -def ta_cones(**kwargs): +def ta_cones(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: raise NotImplementedError("Command `ta/cones` does not have a charting function") -def ta_ema(**kwargs): +def ta_ema(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: ma_type = "ema" return _ta_ma(ma_type, **kwargs) + + +def forex_pairs(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: + raise NotImplementedError("Command `forex/pairs` does not have a charting function") + + +def economy_const(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: + raise NotImplementedError( + "Command `economy/const` does not have a charting function" + ) + + +def economy_risk(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: + raise NotImplementedError( + "Command `economy/risk` does not have a charting function" + ) + + +def stocks_fa_comsplit(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: + raise NotImplementedError( + "Command `stocks/fa/comsplit` does not have a charting function" + ) + + +def stocks_ins_filt(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: + raise NotImplementedError( + "Command `stocks/ins/filt` does not have a charting function" + ) + + +def stocks_multiples(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]: + data = basemodel_to_df( + kwargs["command_output_item"], index=kwargs.get("index", "date") + ) + standard_params = kwargs["standard_params"].__dict__ + columnwidth = standard_params.get("columnwidth", None) + + tbl_fig = OpenBBFigureTable(tabular_data=data, columnwidth=columnwidth) + content = tbl_fig.to_table().show(external=True).to_plotly_json() + + return tbl_fig, content diff --git a/openbb_sdk/extensions/charting/openbb_charting/core/chart_style.py b/openbb_sdk/extensions/charting/openbb_charting/core/chart_style.py index eb52de74e08..e90491b95af 100644 --- a/openbb_sdk/extensions/charting/openbb_charting/core/chart_style.py +++ b/openbb_sdk/extensions/charting/openbb_charting/core/chart_style.py @@ -137,7 +137,7 @@ class ChartStyle: for attr, ext in zip( ["plt_styles_available", "console_styles_available"], - [".pltstyle", ".richstyle.json"], + [".pltstyle.json", ".richstyle.json"], ): for file in folder.rglob(f"*{ext}"): getattr(self, attr)[file.name.replace(ext, "")] = file diff --git a/openbb_sdk/extensions/charting/openbb_charting/core/openbb_figure.py b/openbb_sdk/extensions/charting/openbb_charting/core/openbb_figure.py index 718bb7d1c3e..fd35d1238f5 100644 --- a/openbb_sdk/extensions/charting/openbb_charting/core/openbb_figure.py +++ b/openbb_sdk/extensions/charting/openbb_charting/core/openbb_figure.py @@ -338,9 +338,7 @@ class OpenBBFigure(go.Figure): for i, (x_i, name_i, color_i) in enumerate(zip(valid_x, name, colors)): if not color_i: color_i = ( # noqa: PLW2901 - self._self._theme.up_color - if i % 2 == 0 - else self._self._theme.down_color + self._theme.up_color if i % 2 == 0 else self._theme.down_color ) res_mean, res_std = np.mean(x_i), np.std(x_i) @@ -386,7 +384,7 @@ class OpenBBFigure(go.Figure): name=name_i if len(name) < 2 else name[1], mode="markers", marker=dict( - color=self._self._theme.down_color, + color=self._theme.down_color, symbol="line-ns-open", size=8, ), @@ -1381,7 +1379,7 @@ class OpenBBFigure(go.Figure): height = kwargs.pop("height", len(data.index) * 28 + 25) width = kwargs.pop("width", sum(columnwidth) * 8.7) - fig: OpenBBFigure = cls() + fig = OpenBBFigure(**kwargs) fig.add_table( header=dict(values=header_values), cells=dict( diff --git a/openbb_sdk/extensions/charting/openbb_charting/core/openbb_figure_table.py b/openbb_sdk/extensions/charting/openbb_charting/core/openbb_figure_table.py new file mode 100644 index 00000000000..b0d131a7251 --- /dev/null +++ b/openbb_sdk/extensions/charting/openbb_charting/core/openbb_figure_table.py @@ -0,0 +1,95 @@ +from typing import List, Optional, Union + +import pandas as pd + +from openbb_sdk.extensions.charting.openbb_charting.core.openbb_figure import ( + OpenBBFigure, +) + + +class OpenBBFigureTable(OpenBBFigure): + def __init__( + self, + tabular_data: pd.DataFrame, + columnwidth: Optional[List[Union[int, float]]] = None, + ): + super().__init__() + self._tabular_data = tabular_data + self._columnwidth = columnwidth + + def show( + self, + show_index: Optional[bool] = True, + index_name: Optional[str] = "", + headers: Optional[Union[List[str], pd.Index]] = None, + title: Optional[str] = "", + source: Optional[str] = "", + external: Optional[bool] = False, + ) -> Optional["OpenBBFigureTable"]: + if external: + return self + + if not self._backend.isatty: + tmp_fig = self.to_table() + tmp_fig.show() + else: + # Make a copy of the dataframe to avoid SettingWithCopyWarning + df = self._tabular_data.copy() + + show_index = not isinstance(df.index, pd.RangeIndex) and show_index + # convert non-str that are not timestamp or int into str + # eg) praw.models.reddit.subreddit.Subreddit + for col in df.columns: + try: + if not any( + isinstance(df[col].iloc[x], pd.Timestamp) + for x in range(min(10, len(df))) + ): + df[col] = pd.to_numeric(df[col], errors="ignore") + except (ValueError, TypeError): + df[col] = df[col].astype(str) + + def _get_headers(_headers: Union[List[str], pd.Index]) -> List[str]: + """Check if headers are valid and return them.""" + output = _headers + if isinstance(_headers, pd.Index): + output = list(_headers) + if len(output) != len(df.columns): + raise ( + ValueError( + "Length of headers does not match length of DataFrame" + ) + ) + return output + + df_outgoing = df.copy() + # If headers are provided, use them + if headers is not None: + # We check if headers are valid + df_outgoing.columns = _get_headers(headers) + + if show_index and index_name not in df_outgoing.columns: + # If index name is provided, we use it + df_outgoing.index.name = index_name or "Index" + df_outgoing = df_outgoing.reset_index() + + for col in df_outgoing.columns: + if col == "": + df_outgoing = df_outgoing.rename(columns={col: " "}) + + self._backend.send_table( + df_table=df_outgoing, + title=title, + source=source, # type: ignore + theme=self._charting_settings.table_style, + ) + + def to_table( + self, + print_index: bool = True, + **kwargs, + ) -> "OpenBBFigure": + data = self._tabular_data + columnwidth = self._columnwidth + + return super().to_table(data, columnwidth, print_index, **kwargs) diff --git a/openbb_sdk/extensions/charting/openbb_charting/core/to_plotly_json.py b/openbb_sdk/extensions/charting/openbb_charting/core/to_chart.py similarity index 88% rename from openbb_sdk/extensions/charting/openbb_charting/core/to_plotly_json.py rename to openbb_sdk/extensions/charting/openbb_charting/core/to_chart.py index 2a5745ae08b..f707a6aaab2 100644 --- a/openbb_sdk/extensions/charting/openbb_charting/core/to_plotly_json.py +++ b/openbb_sdk/extensions/charting/openbb_charting/core/to_chart.py @@ -1,12 +1,13 @@ -from typing import Any, Dict, Optional, Union +from typing import Any, Dict, Optional, Tuple, Union import pandas as pd +from openbb_charting.core.openbb_figure import OpenBBFigure from openbb_charting.core.plotly_ta.data_classes import ChartIndicators from openbb_charting.core.plotly_ta.ta_class import PlotlyTA from openbb_core.app.model.charts.charting_settings import ChartingSettings -def to_plotly_json( +def to_chart( charting_settings: ChartingSettings, data: Union[pd.DataFrame, pd.Series], indicators: Optional[Union[ChartIndicators, Dict[str, Dict[str, Any]]]] = None, @@ -15,7 +16,7 @@ def to_plotly_json( volume: bool = True, prepost: bool = False, volume_ticks_x: int = 7, -) -> str: +) -> Tuple[OpenBBFigure, Dict[str, Any]]: """ Returns the plotly json representation of the chart. This function is used so it can be called at the module level and used out of the box, @@ -57,5 +58,6 @@ def to_plotly_json( prepost=prepost, volume_ticks_x=volume_ticks_x, ) + content = fig.show(external=True).to_plotly_json() - return fig.show(external=True).to_plotly_json() + return fig, content diff --git a/openbb_sdk/extensions/charting/openbb_charting/styles/default/dark.pltstyle b/openbb_sdk/extensions/charting/openbb_charting/styles/default/dark.pltstyle.json similarity index 100% rename from openbb_sdk/extensions/charting/openbb_charting/styles/default/dark.pltstyle rename to openbb_sdk/extensions/charting/openbb_charting/styles/default/dark.pltstyle.json diff --git a/openbb_sdk/extensions/charting/openbb_charting/styles/default/light.pltstyle b/openbb_sdk/extensions/charting/openbb_charting/styles/default/light.pltstyle.json similarity index 100% rename from openbb_sdk/extensions/charting/openbb_charting/styles/default/light.pltstyle rename to openbb_sdk/extensions/charting/openbb_charting/styles/default/light.pltstyle.json diff --git a/openbb_sdk/extensions/charting/openbb_charting/styles/default/tables.pltstyle.json b/openbb_sdk/extensions/charting/openbb_charting/styles/default/tables.pltstyle.json new file mode 100644 index 00000000000..69f80ef4d88 --- /dev/null +++ b/openbb_sdk/extensions/charting/openbb_charting/styles/default/tables.pltstyle.json @@ -0,0 +1,102 @@ +{ + "data": { + "candlestick": [ + { + "decreasing": { + "fillcolor": "#e4003a", + "line": { + "color": "#e4003a" + } + }, + "increasing": { + "fillcolor": "#00ACFF", + "line": { + "color": "#00ACFF" + } + }, + "type": "candlestick" + } + ] + }, + "layout": { + "annotationdefaults": { + "showarrow": false + }, + "autotypenumbers": "strict", + "colorway": [ + "#ffed00", + "#ef7d00", + "#e4003a", + "#c13246", + "#822661", + "#48277c", + "#005ca9", + "#00aaff", + "#9b30d9", + "#af005f", + "#5f00af", + "#af87ff" + ], + "dragmode": "pan", + "font": { + "family": "Fira Code", + "size": 18 + }, + "hoverlabel": { + "align": "left" + }, + "mapbox": { + "style": "light" + }, + "hovermode": "x", + "legend": { + "bgcolor": "rgba(0, 0, 0, 0)", + "x": 0.01, + "xanchor": "left", + "y": 0.99, + "yanchor": "top", + "font": { + "size": 15 + } + }, + "paper_bgcolor": "white", + "plot_bgcolor": "white", + "xaxis": { + "automargin": true, + "autorange": true, + "rangeslider": { + "visible": false + }, + "showgrid": true, + "showline": true, + "tickfont": { + "size": 14 + }, + "zeroline": false, + "tick0": 1, + "title": { + "standoff": 20 + }, + "linecolor": "#F5EFF3", + "mirror": true, + "ticks": "outside" + }, + "yaxis": { + "anchor": "x", + "automargin": true, + "fixedrange": false, + "zeroline": false, + "showgrid": true, + "showline": true, + "side": "right", + "tick0": 0.5, + "title": { + "standoff": 20 + }, + "gridcolor": "#283442", + "linecolor": "#F5EFF3", + "mirror": true, + "ticks": "outside" + } + } +} diff --git a/openbb_sdk/sdk/core/openbb_core/api/router/commands.py b/openbb_sdk/sdk/core/openbb_core/api/router/commands.py index a3c1c00b2b2..49ee6a65c5a 100644 --- a/openbb_sdk/sdk/core/openbb_core/api/router/commands.py +++ b/openbb_sdk/sdk/core/openbb_core/api/router/commands.py @@ -1,3 +1,4 @@ +import inspect from functools import partial, wraps from inspect import Parameter, Signature, signature from typing import Any, Callable, Dict, Tuple, TypeVar @@ -7,9 +8,11 @@ from fastapi.routing import APIRoute from openbb_core.api.dependency.user import get_user from openbb_core.app.command_runner import CommandRunner from openbb_core.app.model.command_context import CommandContext +from openbb_core.app.model.command_output import CommandOutput from openbb_core.app.model.user_settings import UserSettings from openbb_core.app.router import RouterLoader from openbb_core.app.service.system_service import SystemService +from pydantic import BaseModel from typing_extensions import Annotated, ParamSpec T = TypeVar("T") @@ -73,6 +76,52 @@ def build_new_signature(func): ) +def validate_output(c_out: CommandOutput) -> CommandOutput: + """ + Validate CommandOutput object. + Checks against the CommandOutput schema and removes fields that contain the + `exclude_from_api` extra `pydantic.Field` kwarg. + Note that the modification to the `CommandOutput` object is done in-place. + + Parameters + ---------- + c_out : CommandOutput + CommandOutput object to validate. + + Returns + ------- + CommandOutput + Validated CommandOutput object. + """ + + def is_model(type_): + return inspect.isclass(type_) and issubclass(type_, BaseModel) + + def exclude_fields_from_api(key: str, value: Any): + type_ = type(value) + + # case where 1st layer field needs to be excluded + if key in c_out.__fields__ and c_out.__fields__[key].field_info.extra.get( + "exclude_from_api", None + ): + delattr(c_out, key) + + # if it's a model with nested fields + elif is_model(type_): + for field in type_.__fields__.values(): + if field.field_info.extra.get("exclude_from_api", None): + delattr(value, field.name) + + # if it's a yet a nested model we need to go deeper in the recursion + elif is_model(field.type_): + exclude_fields_from_api(field.name, getattr(value, field.name)) + + for k, v in c_out: + exclude_fields_from_api(k, v) + + return c_out + + def build_api_wrapper( command_runner: CommandRunner, route: APIRoute, @@ -97,7 +146,7 @@ def build_api_wrapper( execute = partial(command_runner.run_once, user_settings, path) journal_entry = execute(*args, **kwargs) - return journal_entry.output + return validate_output(journal_entry.output) return wrapper diff --git a/openbb_sdk/sdk/core/openbb_core/app/charting_manager.py b/openbb_sdk/sdk/core/openbb_core/app/charting_manager.py index 5f6fc25289f..d0f8188d7a8 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/charting_manager.py +++ b/openbb_sdk/sdk/core/openbb_core/app/charting_manager.py @@ -144,10 +144,28 @@ class ChartingManager(metaclass=SingletonMeta): create_backend_func(charting_settings=charting_settings) get_backend_func().start(debug=charting_settings.debug_mode) - def to_plotly_json(self, **kwargs) -> str: + def to_chart(self, **kwargs) -> Chart: """ - Returns the plotly json representation of the chart. + Returns the chart object. + + Parameters + ---------- + **kwargs + Keyword arguments to be passed to the charting extension. + + Returns + ------- + Chart + Chart object. + + Raises + ------ + ChartingManagerError + If charting extension is not installed. + Exception + If the charting extension module does not contain the `to_chart` function. """ + if not self._charting_extension_installed: raise ChartingManagerError( f"Charting extension `{self._charting_extension}` is not installed" @@ -156,12 +174,19 @@ class ChartingManager(metaclass=SingletonMeta): # Dynamically import the charting module backend_module = import_module(self._charting_extension) - # Get the plotly json function from the charting module - to_plotly_json_func = getattr(backend_module, "to_plotly_json") + # Get the `to_chart` function from the charting module + to_chart_func = getattr(backend_module, "to_chart") + # Add the charting settings to the kwargs kwargs["charting_settings"] = self._charting_settings - return to_plotly_json_func(**kwargs) + fig, content = to_chart_func(**kwargs) + + return Chart( + content=content, + format=self.get_chart_format(self._charting_extension), + fig=fig, + ) def chart( self, @@ -211,7 +236,11 @@ class ChartingManager(metaclass=SingletonMeta): kwargs["command_output_item"] = command_output_item kwargs["charting_settings"] = self._charting_settings + charting_function = self.get_chart_function(self._charting_extension, route) + fig, content = charting_function(**kwargs) + return Chart( - content=self.get_chart_function(self._charting_extension, route)(**kwargs), + content=content, format=self.get_chart_format(self._charting_extension), + fig=fig, ) diff --git a/openbb_sdk/sdk/core/openbb_core/app/model/charts/chart.py b/openbb_sdk/sdk/core/openbb_core/app/model/charts/chart.py index e29559a9895..76eabc1cace 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/model/charts/chart.py +++ b/openbb_sdk/sdk/core/openbb_core/app/model/charts/chart.py @@ -2,7 +2,7 @@ from enum import Enum from typing import Any, Dict, Optional from openbb_core.app.model.abstract.error import Error -from pydantic import BaseModel +from pydantic import BaseModel, Field class ChartFormat(str, Enum): @@ -10,28 +10,30 @@ class ChartFormat(str, Enum): class Chart(BaseModel): - content: Optional[Dict[str, Any]] = None - format: Optional[ChartFormat] = ChartFormat.plotly - error: Optional[Error] = None + content: Optional[Dict[str, Any]] = Field( + default=None, + description="Raw textual representation of the chart.", + ) + format: Optional[ChartFormat] = Field( + default=ChartFormat.plotly, + description="Complementary attribute to the `content` attribute. It specifies the format of the chart.", + ) + error: Optional[Error] = Field( + default=None, + description="Exception caught during the computation of the `Chart`.", + ) + fig: Optional[Any] = Field( + default=None, + description="The figure object.", + exclude_from_api=True, + ) class Config: validate_assignment = True - def show(self): - """Shows the chart in PyWry, browser or notebook.""" - - # TODO : this method should be handled by the ChartingManager so that - # this model class doesn't have specific knowledge on the charting extension - - # pylint: disable=import-outside-toplevel - if self.format == ChartFormat.plotly: - from openbb_charting.core.openbb_figure import OpenBBFigure - - chart = OpenBBFigure() - - chart.update(self.content) - - chart.show() - - else: - raise ValueError(f"Chart format {self.format} not supported.") + def __repr__(self) -> str: + return ( + self.__class__.__name__ + + "\n\n" + + "\n".join([f"{k}: {v}" for k, v in self.dict().items()]) + ) diff --git a/openbb_sdk/sdk/core/openbb_core/app/model/charts/charting_settings.py b/openbb_sdk/sdk/core/openbb_core/app/model/charts/charting_settings.py index f0ab0d68466..45f423acab1 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/model/charts/charting_settings.py +++ b/openbb_sdk/sdk/core/openbb_core/app/model/charts/charting_settings.py @@ -43,9 +43,8 @@ class ChartingSettings: self.user_uuid: Optional[str] = ( user_settings.profile.hub_session.user_uuid if has_hub else None ) - self.user_exports_directory: str = user_settings.preferences.export_directory - self.user_styles_directory: str = ( - user_settings.preferences.user_styles_directory - ) + self.user_exports_directory = user_settings.preferences.export_directory + self.user_styles_directory = user_settings.preferences.user_styles_directory # Theme self.chart_style: str = user_settings.preferences.chart_style + self.table_style = user_settings.preferences.table_style diff --git a/openbb_sdk/sdk/core/openbb_core/app/model/command_output.py b/openbb_sdk/sdk/core/openbb_core/app/model/command_output.py index 77284f14a39..618e17bd628 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/model/command_output.py +++ b/openbb_sdk/sdk/core/openbb_core/app/model/command_output.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, Generic, List, Optional, TypeVar, Union +from typing import Dict, Generic, List, Optional, TypeVar, Union import pandas as pd from pydantic import Field @@ -8,7 +8,7 @@ from openbb_core.app.charting_manager import ChartingManager from openbb_core.app.model.abstract.error import Error from openbb_core.app.model.abstract.tagged import Tagged from openbb_core.app.model.abstract.warning import Warning_ -from openbb_core.app.model.charts.chart import Chart, ChartFormat +from openbb_core.app.model.charts.chart import Chart from openbb_core.app.provider_interface import get_provider_interface from openbb_core.app.utils import basemodel_to_df @@ -105,41 +105,31 @@ class CommandOutput(GenericModel, Generic[T], Tagged): return results - def to_plotly_json( - self, create_chart: bool = True, **kwargs - ) -> Optional[Dict[str, Any]]: + def to_chart(self, **kwargs): """ - Returns the plotly json representation of the chart. - If the chart was already computed it return the plotly json representation of the chart. - Otherwise it computes the chart based on the available data and provided kwargs. + Create or update the `Chart`. + Note that the `chart` attribute is composed by: `content`, `format` and `fig`. Parameters ---------- - create_chart : bool, optional - If True, it creates the chart object and populates the respective field on the object, by default True. **kwargs Keyword arguments to be passed to the charting extension. - This implies that the user has to know the charting extension API; this is the case - because the charting extension may vary on user settings. + This implies that the user has some knowledge on the charting extension API. + This is the case because the charting extension may vary on user preferences. + + Returns + ------- + chart.fig + The chart figure. """ + cm = ChartingManager() + kwargs["data"] = self.to_dataframe() - if self.chart and not kwargs: - plotly_json = self.chart.content - else: - cm = ChartingManager() - kwargs["data"] = self.to_dataframe() - plotly_json = cm.to_plotly_json(**kwargs) - - if create_chart: - try: - self.chart = Chart(content=plotly_json, format=ChartFormat.plotly) - except Exception as e: - self.chart = Chart(error=Error(message=str(e))) - - return plotly_json + self.chart = cm.to_chart(**kwargs) + return self.chart.fig def show(self): """Displays chart.""" - if not self.chart: + if not self.chart and not self.chart.fig: raise OpenBBError("Chart not found.") - self.chart.show() + self.chart.fig.show() diff --git a/openbb_sdk/sdk/core/openbb_core/app/model/preferences.py b/openbb_sdk/sdk/core/openbb_core/app/model/preferences.py index e26af23900d..d897ed8ae71 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/model/preferences.py +++ b/openbb_sdk/sdk/core/openbb_core/app/model/preferences.py @@ -16,6 +16,7 @@ class Preferences(BaseModel): plot_open_export: bool = ( False # Whether to open plot image exports after they are created ) + table_style: Literal["dark", "light"] = "dark" request_timeout: PositiveInt = 15 class Config: diff --git a/openbb_sdk/sdk/provider/README.md b/openbb_sdk/sdk/provider/README.md index 65911012d53..31271f98346 100644 --- a/openbb_sdk/sdk/provider/README.md +++ b/openbb_sdk/sdk/provider/README.md @@ -34,7 +34,7 @@ Close for closing price column name in data from one provider might be coded as - **Provider** : Entry point class for each provider extension. Contains information about the provider, it's required credentials and available fetchers. - **RegistryLoader** : Loads the registry with the provider extensions installed. - **Registry** : Maintains a registry of provider extensions installed. -- **RegistryMap** : Stores the complete characterization of each provider. It centralizes information like required credentials, standardised and extra query parameteres/data by provider. +- **RegistryMap** : Stores the complete characterization of each provider. It centralizes information like required credentials, standardised and extra query parameters/data by provider. - **QueryExecutor** : Executes a given query, routing it to the respective provider and fetcher. ## Installation