Skip to content

Commit

Permalink
Add new functionality to measure country performance (#4514)
Browse files Browse the repository at this point in the history
* Add in new country parameters

* Add in tests corresponding to the new commands

* Update SDK and some more robustness

* Update tests

* Update tests

* Revenue and spending didnt work, then saw spending has many more options

* Small bug

* Update tests and overall improvements

* Forgot to add ccpi

* Make more efficient

* Update tests

* Fix IDX issue within real gdp

* Add quarterly flag to fgdp

* Add integration tests

* Update tests

* Fix SDK and related bugs and fix CPI for SDK

* Zzzz tests

---------

Co-authored-by: James Maslek <[email protected]>
  • Loading branch information
JerBouma and jmaslek authored Mar 20, 2023
1 parent cceeb3e commit 6b4f0ad
Show file tree
Hide file tree
Showing 58 changed files with 18,337 additions and 6,695 deletions.
38 changes: 37 additions & 1 deletion openbb_terminal/core/sdk/models/economy_sdk_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@ class EconomyRoot(Category):
Attributes:
`available_indices`: Get available indices\n
`balance`: General government deficit is defined as the balance of income and expenditure of government,\n
`balance_chart`: General government balance is defined as the balance of income and expenditure of government,\n
`bigmac`: Display Big Mac Index for given countries\n
`bigmac_chart`: Display Big Mac Index for given countries\n
`ccpi`: Inflation measured by consumer price index (CPI) is defined as the change in the prices\n
`ccpi_chart`: Inflation measured by consumer price index (CPI) is defined as the change in the prices\n
`country_codes`: Get available country codes for Bigmac index\n
`cpi`: Obtain CPI data from FRED. [Source: FRED]\n
`cpi_chart`: Plot CPI data. [Source: FRED]\n
`cpi_chart`: Inflation measured by consumer price index (CPI) is defined as the change in\n
`currencies`: Scrape data for global currencies\n
`debt`: General government debt-to-GDP ratio measures the gross debt of the general\n
`debt_chart`: General government debt-to-GDP ratio measures the gross debt of the general\n
`events`: Get economic calendar for countries between specified dates\n
`fgdp`: Real gross domestic product (GDP) is GDP given in constant prices and\n
`fgdp_chart`: Real gross domestic product (GDP) is GDP given in constant prices and\n
`fred`: Get Series data. [Source: FRED]\n
`fred_chart`: Display (multiple) series from https://fred.stlouisfed.org. [Source: FRED]\n
`fred_notes`: Get series notes. [Source: FRED]\n
`future`: Get futures data. [Source: Finviz]\n
`futures`: Get futures data.\n
`gdp`: Gross domestic product (GDP) is the standard measure of the value added created\n
`gdp_chart`: Gross domestic product (GDP) is the standard measure of the value added created\n
`get_groups`: Get group available\n
`glbonds`: Scrape data for global bonds\n
`index`: Get data on selected indices over time [Source: Yahoo Finance]\n
Expand All @@ -34,13 +44,21 @@ class EconomyRoot(Category):
`overview`: Scrape data for market overview\n
`perfmap`: Opens Finviz map website in a browser. [Source: Finviz]\n
`performance`: Get group (sectors, industry or country) performance data. [Source: Finviz]\n
`revenue`: Governments collect revenues mainly for two purposes: to finance the goods\n
`revenue_chart`: Governments collect revenues mainly for two purposes: to finance the goods\n
`rgdp`: Gross domestic product (GDP) is the standard measure of the value added\n
`rgdp_chart`: Gross domestic product (GDP) is the standard measure of the value added\n
`rtps`: Get real-time performance sector data\n
`rtps_chart`: Display Real-Time Performance sector. [Source: AlphaVantage]\n
`search_index`: Search indices by keyword. [Source: FinanceDatabase]\n
`spectrum`: Display finviz spectrum in system viewer [Source: Finviz]\n
`spending`: General government spending provides an indication of the size\n
`spending_chart`: General government spending provides an indication of the size\n
`treasury`: Get U.S. Treasury rates [Source: EconDB]\n
`treasury_chart`: Display U.S. Treasury rates [Source: EconDB]\n
`treasury_maturities`: Get treasury maturity options [Source: EconDB]\n
`trust`: Trust in government refers to the share of people who report having confidence in\n
`trust_chart`: Trust in government refers to the share of people who report having confidence in\n
`usbonds`: Scrape data for us bonds\n
`valuation`: Get group (sectors, industry or country) valuation data. [Source: Finviz]\n
"""
Expand All @@ -50,18 +68,28 @@ class EconomyRoot(Category):
def __init__(self):
super().__init__()
self.available_indices = lib.economy_yfinance_model.get_available_indices
self.balance = lib.economy_oecd_model.get_balance
self.balance_chart = lib.economy_oecd_view.plot_balance
self.bigmac = lib.economy_nasdaq_model.get_big_mac_indices
self.bigmac_chart = lib.economy_nasdaq_view.display_big_mac_index
self.ccpi = lib.economy_oecd_model.get_cpi
self.ccpi_chart = lib.economy_oecd_view.plot_cpi
self.country_codes = lib.economy_nasdaq_model.get_country_codes
self.cpi = lib.economy_fred_model.get_cpi
self.cpi_chart = lib.economy_fred_view.plot_cpi
self.currencies = lib.economy_wsj_model.global_currencies
self.debt = lib.economy_oecd_model.get_debt
self.debt_chart = lib.economy_oecd_view.plot_debt
self.events = lib.economy_nasdaq_model.get_economic_calendar
self.fgdp = lib.economy_oecd_model.get_gdp_forecast
self.fgdp_chart = lib.economy_oecd_view.plot_gdp_forecast
self.fred = lib.economy_fred_model.get_aggregated_series_data
self.fred_chart = lib.economy_fred_view.display_fred_series
self.fred_notes = lib.economy_fred_model.get_series_notes
self.future = lib.economy_finviz_model.get_futures
self.futures = lib.economy_sdk_helpers.futures
self.gdp = lib.economy_oecd_model.get_gdp
self.gdp_chart = lib.economy_oecd_view.plot_gdp
self.get_groups = lib.economy_finviz_model.get_groups
self.glbonds = lib.economy_wsj_model.global_bonds
self.index = lib.economy_yfinance_model.get_indices
Expand All @@ -74,12 +102,20 @@ def __init__(self):
self.overview = lib.economy_wsj_model.market_overview
self.perfmap = lib.economy_finviz_model.get_performance_map
self.performance = lib.economy_finviz_model.get_performance_data
self.revenue = lib.economy_oecd_model.get_revenue
self.revenue_chart = lib.economy_oecd_view.plot_revenue
self.rgdp = lib.economy_oecd_model.get_real_gdp
self.rgdp_chart = lib.economy_oecd_view.plot_real_gdp
self.rtps = lib.economy_alphavantage_model.get_sector_data
self.rtps_chart = lib.economy_alphavantage_view.realtime_performance_sector
self.search_index = lib.economy_yfinance_model.get_search_indices
self.spectrum = lib.economy_finviz_view.display_spectrum
self.spending = lib.economy_oecd_model.get_spending
self.spending_chart = lib.economy_oecd_view.plot_spending
self.treasury = lib.economy_econdb_model.get_treasuries
self.treasury_chart = lib.economy_econdb_view.show_treasuries
self.treasury_maturities = lib.economy_econdb_model.get_treasury_maturities
self.trust = lib.economy_oecd_model.get_trust
self.trust_chart = lib.economy_oecd_view.plot_trust
self.usbonds = lib.economy_wsj_model.us_bonds
self.valuation = lib.economy_finviz_model.get_valuation_data
2 changes: 2 additions & 0 deletions openbb_terminal/core/sdk/sdk_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@
wsj_model as economy_wsj_model,
yfinance_model as economy_yfinance_model,
yfinance_view as economy_yfinance_view,
oecd_model as economy_oecd_model,
oecd_view as economy_oecd_view,
)

# ETF's
Expand Down
25 changes: 17 additions & 8 deletions openbb_terminal/core/sdk/trail_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,20 @@ econometrics.pols,econometrics_regression_model.get_pols,
econometrics.re,econometrics_regression_model.get_re,
econometrics.root,econometrics_model.get_root,econometrics_view.display_root
economy.available_indices,economy_yfinance_model.get_available_indices,
economy.balance,economy_oecd_model.get_balance,economy_oecd_view.plot_balance
economy.bigmac,economy_nasdaq_model.get_big_mac_indices,economy_nasdaq_view.display_big_mac_index
economy.ccpi,economy_oecd_model.get_cpi,economy_oecd_view.plot_cpi
economy.country_codes,economy_nasdaq_model.get_country_codes,
economy.cpi,economy_fred_model.get_cpi,economy_fred_view.plot_cpi
economy.currencies,economy_wsj_model.global_currencies,
economy.debt,economy_oecd_model.get_debt,economy_oecd_view.plot_debt
economy.events,economy_nasdaq_model.get_economic_calendar,
economy.fgdp,economy_oecd_model.get_gdp_forecast,economy_oecd_view.plot_gdp_forecast
economy.fred,economy_fred_model.get_aggregated_series_data,economy_fred_view.display_fred_series
economy.fred_notes,economy_fred_model.get_series_notes,
economy.future,economy_finviz_model.get_futures,
economy.futures,economy_sdk_helpers.futures,
economy.gdp,economy_oecd_model.get_gdp,economy_oecd_view.plot_gdp
economy.get_groups,economy_finviz_model.get_groups,
economy.glbonds,economy_wsj_model.global_bonds,
economy.index,economy_yfinance_model.get_indices,economy_yfinance_view.show_indices
Expand All @@ -197,12 +203,15 @@ economy.macro_parameters,economy_econdb_model.get_macro_parameters,
economy.overview,economy_wsj_model.market_overview,
economy.perfmap,economy_finviz_model.get_performance_map,
economy.performance,economy_finviz_model.get_performance_data,
economy.revenue,economy_oecd_model.get_revenue,economy_oecd_view.plot_revenue
economy.rgdp,economy_oecd_model.get_real_gdp,economy_oecd_view.plot_real_gdp
economy.rtps,economy_alphavantage_model.get_sector_data,economy_alphavantage_view.realtime_performance_sector
economy.search_index,economy_yfinance_model.get_search_indices,
economy.spectrum,economy_finviz_view.display_spectrum,
economy.spending,economy_oecd_model.get_spending,economy_oecd_view.plot_spending
economy.treasury,economy_econdb_model.get_treasuries,economy_econdb_view.show_treasuries
economy.treasury_maturities,economy_econdb_model.get_treasury_maturities,
economy.cpi,economy_fred_model.get_cpi,economy_fred_view.plot_cpi
economy.trust,economy_oecd_model.get_trust,economy_oecd_view.plot_trust
economy.usbonds,economy_wsj_model.us_bonds,
economy.valuation,economy_finviz_model.get_valuation_data,
etf.candle,stocks_helper.display_candle,
Expand Down Expand Up @@ -360,25 +369,25 @@ qa.spread,common_qa_rolling_model.get_spread,common_qa_rolling_view.display_spre
qa.summary,common_qa_model.get_summary,common_qa_view.display_summary
qa.unitroot,common_qa_model.get_unitroot,common_qa_view.display_unitroot
qa.var,common_qa_model.get_var,common_qa_view.display_var
stocks.ba.headlines,stocks_ba_finbrain_model.get_sentiment,stocks_ba_finbrain_view.display_sentiment_analysis
stocks.ba.bullbear,stocks_ba_stocktwits_model.get_bullbear,
stocks.ba.cnews,stocks_ba_finnhub_model.get_company_news,
stocks.ba.wsb,stocks_ba_reddit_model.get_wsb_community,
stocks.ba.popular,stocks_ba_reddit_model.get_popular_tickers,
stocks.ba.spacc,stocks_ba_reddit_model.get_spac_community,
stocks.ba.getdd,stocks_ba_reddit_model.get_due_dilligence,
stocks.ba.redditsent,stocks_ba_reddit_model.get_posts_about,
stocks.ba.bullbear,stocks_ba_stocktwits_model.get_bullbear,
stocks.ba.headlines,stocks_ba_finbrain_model.get_sentiment,stocks_ba_finbrain_view.display_sentiment_analysis
stocks.ba.infer,stocks_ba_twitter_model.load_analyze_tweets,stocks_ba_twitter_view.display_inference
stocks.ba.mentions,stocks_ba_google_model.get_mentions,stocks_ba_google_view.display_mentions
stocks.ba.messages,stocks_ba_stocktwits_model.get_messages,
stocks.ba.popular,stocks_ba_reddit_model.get_popular_tickers,
stocks.ba.queries,stocks_ba_google_model.get_queries,
stocks.ba.redditsent,stocks_ba_reddit_model.get_posts_about,
stocks.ba.regions,stocks_ba_google_model.get_regions,stocks_ba_google_view.display_regions
stocks.ba.rise,stocks_ba_google_model.get_rise,
stocks.ba.sentiment,stocks_ba_twitter_model.get_sentiment,stocks_ba_twitter_view.display_sentiment
stocks.ba.snews,stocks_ba_finnhub_model.get_headlines_sentiment,stocks_ba_finnhub_view.display_stock_price_headlines_sentiment
stocks.ba.spacc,stocks_ba_reddit_model.get_spac_community,
stocks.ba.stalker,stocks_ba_stocktwits_model.get_stalker,
stocks.ba.text_sent,stocks_ba_reddit_model.get_sentiment,
stocks.ba.trending,stocks_ba_stocktwits_model.get_trending,
stocks.ba.wsb,stocks_ba_reddit_model.get_wsb_community,
stocks.ca.balance,stocks_ca_marketwatch_model.get_balance_comparison,
stocks.ca.cashflow,stocks_ca_marketwatch_model.get_cashflow_comparison,
stocks.ca.hcorr,stocks_ca_yahoo_finance_model.get_correlation,stocks_ca_yahoo_finance_view.display_correlation
Expand Down Expand Up @@ -555,8 +564,8 @@ ta.rvol_parkinson,common_ta_volatility_model.parkinson,
ta.rvol_rogers_satchell,common_ta_volatility_model.rogers_satchell,
ta.rvol_std,common_ta_volatility_model.standard_deviation,
ta.rvol_yang_zhang,common_ta_volatility_model.yang_zhang,
ta.standard_deviation,common_ta_volatility_model.standard_deviation,
ta.sma,common_ta_overlap_model.sma,
ta.standard_deviation,common_ta_volatility_model.standard_deviation,
ta.stoch,common_ta_momentum_model.stoch,common_ta_momentum_view.display_stoch
ta.vwap,common_ta_overlap_model.vwap,common_ta_overlap_view.view_vwap
ta.wma,common_ta_overlap_model.wma,
Expand Down
80 changes: 40 additions & 40 deletions openbb_terminal/core/sdk/trail_map_forecasting.csv
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
trail,model,view
forecast.anom,forecast_anom_model.get_anomaly_detection_data,forecast_anom_view.display_anomaly_detection
forecast.atr,forecast_model.add_atr,
forecast.autoarima,forecast_autoarima_model.get_autoarima_data,forecast_autoarima_view.display_autoarima_forecast
forecast.autoces,forecast_autoces_model.get_autoces_data,forecast_autoces_view.display_autoces_forecast
forecast.autoets,forecast_autoets_model.get_autoets_data,forecast_autoets_view.display_autoets_forecast
forecast.autoselect,forecast_autoselect_model.get_autoselect_data,forecast_autoselect_view.display_autoselect_forecast
forecast.brnn,forecast_brnn_model.get_brnn_data,forecast_brnn_view.display_brnn_forecast
forecast.clean,forecast_model.clean,
forecast.combine,forecast_model.combine_dfs,
forecast.corr,forecast_model.corr_df,forecast_view.display_corr
forecast.delete,forecast_model.delete_column,
forecast.delta,forecast_model.add_delta,
forecast.desc,forecast_model.describe_df,forecast_view.describe_df
forecast.ema,forecast_model.add_ema,
forecast.expo,forecast_expo_model.get_expo_data,forecast_expo_view.display_expo_forecast
forecast.export,forecast_view.export_df,
forecast.linregr,forecast_linregr_model.get_linear_regression_data,forecast_linregr_view.display_linear_regression
forecast.load,common_model.load,
forecast.mom,forecast_model.add_momentum,
forecast.mstl,forecast_mstl_model.get_mstl_data,forecast_mstl_view.display_mstl_forecast
forecast.nbeats,forecast_nbeats_model.get_NBEATS_data,forecast_nbeats_view.display_nbeats_forecast
forecast.nhits,forecast_nhits_model.get_nhits_data,forecast_nhits_view.display_nhits_forecast
forecast.plot,forecast_view.display_plot,forecast_view.display_plot
forecast.regr,forecast_regr_model.get_regression_data,forecast_regr_view.display_regression
forecast.rename,forecast_model.rename_column,
forecast.rnn,forecast_rnn_model.get_rnn_data,forecast_rnn_view.display_rnn_forecast
forecast.roc,forecast_model.add_roc,
forecast.rsi,forecast_model.add_rsi,
forecast.rwd,forecast_rwd_model.get_rwd_data,forecast_rwd_view.display_rwd_forecast
forecast.season,,forecast_view.display_seasonality
forecast.seasonalnaive,forecast_seasonalnaive_model.get_seasonalnaive_data,forecast_seasonalnaive_view.display_seasonalnaive_forecast
forecast.show,forecast_view.show_df,
forecast.signal,forecast_model.add_signal,
forecast.sto,forecast_model.add_sto,
forecast.tcn,forecast_tcn_model.get_tcn_data,forecast_tcn_view.display_tcn_forecast
forecast.tft,forecast_tft_model.get_tft_data,forecast_tft_view.display_tft_forecast
forecast.theta,forecast_theta_model.get_theta_data,forecast_theta_view.display_theta_forecast
forecast.trans,forecast_trans_model.get_trans_data,forecast_trans_view.display_trans_forecast
forecast.whisper,forecast_whisper_model.transcribe_and_summarize,
trail,model,view
forecast.anom,forecast_anom_model.get_anomaly_detection_data,forecast_anom_view.display_anomaly_detection
forecast.atr,forecast_model.add_atr,
forecast.autoarima,forecast_autoarima_model.get_autoarima_data,forecast_autoarima_view.display_autoarima_forecast
forecast.autoces,forecast_autoces_model.get_autoces_data,forecast_autoces_view.display_autoces_forecast
forecast.autoets,forecast_autoets_model.get_autoets_data,forecast_autoets_view.display_autoets_forecast
forecast.autoselect,forecast_autoselect_model.get_autoselect_data,forecast_autoselect_view.display_autoselect_forecast
forecast.brnn,forecast_brnn_model.get_brnn_data,forecast_brnn_view.display_brnn_forecast
forecast.clean,forecast_model.clean,
forecast.combine,forecast_model.combine_dfs,
forecast.corr,forecast_model.corr_df,forecast_view.display_corr
forecast.delete,forecast_model.delete_column,
forecast.delta,forecast_model.add_delta,
forecast.desc,forecast_model.describe_df,forecast_view.describe_df
forecast.ema,forecast_model.add_ema,
forecast.expo,forecast_expo_model.get_expo_data,forecast_expo_view.display_expo_forecast
forecast.export,forecast_view.export_df,
forecast.linregr,forecast_linregr_model.get_linear_regression_data,forecast_linregr_view.display_linear_regression
forecast.load,common_model.load,
forecast.mom,forecast_model.add_momentum,
forecast.mstl,forecast_mstl_model.get_mstl_data,forecast_mstl_view.display_mstl_forecast
forecast.nbeats,forecast_nbeats_model.get_NBEATS_data,forecast_nbeats_view.display_nbeats_forecast
forecast.nhits,forecast_nhits_model.get_nhits_data,forecast_nhits_view.display_nhits_forecast
forecast.plot,forecast_view.display_plot,forecast_view.display_plot
forecast.regr,forecast_regr_model.get_regression_data,forecast_regr_view.display_regression
forecast.rename,forecast_model.rename_column,
forecast.rnn,forecast_rnn_model.get_rnn_data,forecast_rnn_view.display_rnn_forecast
forecast.roc,forecast_model.add_roc,
forecast.rsi,forecast_model.add_rsi,
forecast.rwd,forecast_rwd_model.get_rwd_data,forecast_rwd_view.display_rwd_forecast
forecast.season,,forecast_view.display_seasonality
forecast.seasonalnaive,forecast_seasonalnaive_model.get_seasonalnaive_data,forecast_seasonalnaive_view.display_seasonalnaive_forecast
forecast.show,forecast_view.show_df,
forecast.signal,forecast_model.add_signal,
forecast.sto,forecast_model.add_sto,
forecast.tcn,forecast_tcn_model.get_tcn_data,forecast_tcn_view.display_tcn_forecast
forecast.tft,forecast_tft_model.get_tft_data,forecast_tft_view.display_tft_forecast
forecast.theta,forecast_theta_model.get_theta_data,forecast_theta_view.display_theta_forecast
forecast.trans,forecast_trans_model.get_trans_data,forecast_trans_view.display_trans_forecast
forecast.whisper,forecast_whisper_model.transcribe_and_summarize,
Loading

0 comments on commit 6b4f0ad

Please sign in to comment.