From 722fcd6e607eaa81468933a069223e42dc2c6224 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 28 Feb 2023 13:49:47 -0500 Subject: [PATCH] sdk --- .../technical_analysis/volatility_model.py | 10 +++---- .../sdk/controllers/stocks_sdk_controller.py | 2 +- .../core/sdk/models/economy_sdk_model.py | 4 +++ .../core/sdk/models/forecast_sdk_model.py | 1 - .../core/sdk/models/portfolio_sdk_model.py | 1 - .../core/sdk/models/stocks_sdk_model.py | 7 ++--- .../core/sdk/models/ta_sdk_model.py | 26 ++++++++++--------- openbb_terminal/core/sdk/trail_map.csv | 13 +++++----- openbb_terminal/sdk.py | 11 ++++++++ 9 files changed, 46 insertions(+), 29 deletions(-) diff --git a/openbb_terminal/common/technical_analysis/volatility_model.py b/openbb_terminal/common/technical_analysis/volatility_model.py index 00d41e0f558..2ebb2b62403 100644 --- a/openbb_terminal/common/technical_analysis/volatility_model.py +++ b/openbb_terminal/common/technical_analysis/volatility_model.py @@ -264,7 +264,7 @@ def parkinson( Example ------- >>> data = openbb.stocks.load('BTC-USD') - >>> df = openbb.ta.parkinson(data, is_crypto = True) + >>> df = openbb.ta.rvol_parkinson(data, is_crypto = True) """ if window < 1: @@ -321,7 +321,7 @@ def garman_klass( Example ------- >>> data = openbb.stocks.load('BTC-USD') - >>> df = openbb.ta.garman_klass(data, is_crypto = True) + >>> df = openbb.ta.rvol_garman_klass(data, is_crypto = True) """ if window < 1: @@ -378,7 +378,7 @@ def hodges_tompkins( Example ------- >>> data = openbb.stocks.load('BTC-USD') - >>> df = openbb.ta.hodges_tompkins(data, is_crypto = True) + >>> df = openbb.ta.rvol_hodges_tompkins(data, is_crypto = True) """ if window < 2: @@ -439,7 +439,7 @@ def rogers_satchell( Example ------- >>> data = openbb.stocks.load('BTC-USD') - >>> df = openbb.ta.rogers_satchell(data, is_crypto = True) + >>> df = openbb.ta.rvol_rogers_satchell(data, is_crypto = True) """ if window < 1: @@ -496,7 +496,7 @@ def yang_zhang( Example ------- >>> data = openbb.stocks.load('BTC-USD') - >>> df = openbb.ta.yang_zhang(data, is_crypto = True) + >>> df = openbb.ta.rvol_yang_zhang(data, is_crypto = True) """ if window < 2: diff --git a/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py b/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py index 9650acf468e..0bcfa6203ce 100644 --- a/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py +++ b/openbb_terminal/core/sdk/controllers/stocks_sdk_controller.py @@ -272,7 +272,7 @@ class StocksController(model.StocksRoot): `expirations`: Get Option Chain Expirations\n `generate_data`: Gets x values, and y values before and after premiums\n `greeks`: Gets the greeks for a given option\n - `grhist`: Get historical option greeks\n + `grhist`: Get histoical option greeks\n `grhist_chart`: Plots historical greeks for a given option. [Source: Syncretism]\n `hist`: Get historical option pricing.\n `info`: Scrape barchart for options info\n diff --git a/openbb_terminal/core/sdk/models/economy_sdk_model.py b/openbb_terminal/core/sdk/models/economy_sdk_model.py index 8543d45165f..979d466302a 100644 --- a/openbb_terminal/core/sdk/models/economy_sdk_model.py +++ b/openbb_terminal/core/sdk/models/economy_sdk_model.py @@ -13,6 +13,8 @@ class EconomyRoot(Category): `bigmac`: Display Big Mac Index for given countries\n `bigmac_chart`: Display Big Mac Index for given countries\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 `currencies`: Scrape data for global currencies\n `events`: Get economic calendar for countries between specified dates\n `fred`: Get Series data. [Source: FRED]\n @@ -52,6 +54,8 @@ class EconomyRoot(Category): self.bigmac = lib.economy_nasdaq_model.get_big_mac_indices self.bigmac_chart = lib.economy_nasdaq_view.display_big_mac_index 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.events = lib.economy_nasdaq_model.get_economic_calendar self.fred = lib.economy_fred_model.get_aggregated_series_data diff --git a/openbb_terminal/core/sdk/models/forecast_sdk_model.py b/openbb_terminal/core/sdk/models/forecast_sdk_model.py index 75f94b3b339..06c4e0786b5 100644 --- a/openbb_terminal/core/sdk/models/forecast_sdk_model.py +++ b/openbb_terminal/core/sdk/models/forecast_sdk_model.py @@ -78,7 +78,6 @@ class ForecastRoot(Category): if not lib.FORECASTING_TOOLKIT_ENABLED: # pylint: disable=C0415 - from openbb_terminal.rich_config import console console.print(lib.FORECASTING_TOOLKIT_WARNING) diff --git a/openbb_terminal/core/sdk/models/portfolio_sdk_model.py b/openbb_terminal/core/sdk/models/portfolio_sdk_model.py index bc4558a9aea..14457d671fd 100644 --- a/openbb_terminal/core/sdk/models/portfolio_sdk_model.py +++ b/openbb_terminal/core/sdk/models/portfolio_sdk_model.py @@ -178,7 +178,6 @@ class PortfolioPortfolioOptimization(Category): if not lib.OPTIMIZATION_TOOLKIT_ENABLED: # pylint: disable=C0415 - from openbb_terminal.rich_config import console console.print(lib.OPTIMIZATION_TOOLKIT_WARNING) diff --git a/openbb_terminal/core/sdk/models/stocks_sdk_model.py b/openbb_terminal/core/sdk/models/stocks_sdk_model.py index 0b5214a43a6..24999097e5e 100644 --- a/openbb_terminal/core/sdk/models/stocks_sdk_model.py +++ b/openbb_terminal/core/sdk/models/stocks_sdk_model.py @@ -456,6 +456,9 @@ class StocksInsiders(Category): class StocksOptions(Category): """Options Module. + Submodules: + `screen`: Screen Module + Attributes: `chains`: Get Option Chain For A Stock. No greek data is returned\n `dte`: Gets days to expiration from yfinance option date\n @@ -463,7 +466,7 @@ class StocksOptions(Category): `expirations`: Get Option Chain Expirations\n `generate_data`: Gets x values, and y values before and after premiums\n `greeks`: Gets the greeks for a given option\n - `grhist`: Get historical option greeks\n + `grhist`: Get histoical option greeks\n `grhist_chart`: Plots historical greeks for a given option. [Source: Syncretism]\n `hist`: Get historical option pricing.\n `info`: Scrape barchart for options info\n @@ -473,7 +476,6 @@ class StocksOptions(Category): `pcr`: Gets put call ratio over last time window [Source: AlphaQuery.com]\n `pcr_chart`: Display put call ratio [Source: AlphaQuery.com]\n `price`: Get Option current price for a stock.\n - `screen`: Equity options screener [Source: Syncretism]\n `unu`: Get unusual option activity from fdscanner.com\n `unu_chart`: Displays the unusual options table\n `voi`: Plot volume and open interest\n @@ -504,7 +506,6 @@ class StocksOptions(Category): self.pcr = lib.stocks_options_alphaquery_model.get_put_call_ratio self.pcr_chart = lib.stocks_options_alphaquery_view.display_put_call_ratio self.price = lib.stocks_options_sdk_helper.get_option_current_price - self.screen = lib.stocks_options_screen_syncretism_model.get_screener_output self.unu = lib.stocks_options_fdscanner_model.unusual_options self.unu_chart = lib.stocks_options_fdscanner_view.display_options self.voi = lib.stocks_options_view.plot_voi diff --git a/openbb_terminal/core/sdk/models/ta_sdk_model.py b/openbb_terminal/core/sdk/models/ta_sdk_model.py index 692602c3260..ac57eaff2e3 100644 --- a/openbb_terminal/core/sdk/models/ta_sdk_model.py +++ b/openbb_terminal/core/sdk/models/ta_sdk_model.py @@ -27,6 +27,8 @@ class TaRoot(Category): `cg_chart`: Plots center of gravity Indicator\n `clenow`: Gets the Clenow Volatility Adjusted Momentum. this is defined as the regression coefficient on log prices\n `clenow_chart`: Prints table and plots clenow momentum\n + `cones`: Returns a DataFrame of realized volatility quantiles.\n + `cones_chart`: Plots the realized volatility quantiles for the loaded ticker.\n `demark`: Get the integer value for demark sequential indicator\n `demark_chart`: Plot demark sequential indicator\n `donchian`: Calculate Donchian Channels\n @@ -47,15 +49,14 @@ class TaRoot(Category): `obv_chart`: Plots OBV technical indicator\n `rsi`: Relative strength index\n `rsi_chart`: Plots RSI Indicator\n - `rvol_std`: Standard deviation model for realized volatility.\n - `rvol_parkinson`: Parkinson's model for realized volatility.\n - `rvol_garman_klass`: Garman-Klass model for realized volatility.\n - `rvol_hodges_tompkins`: Hodges-Tompkins model for realized volatility.\n - `rvol_rogers-satchell`: Rogers-Satterthwaite model for realized volatility.\n - `rvol_yang_zhang`: Yang-Zhang model for realized volatility.\n - `cones`: Realized Volatility Cones\n - `cones_chart`: Plots Realized Volatility Cones\n + `rvol_garman_klass`: Garman-Klass volatility extends Parkinson volatility by taking into account the opening and closing price.\n + `rvol_hodges_tompkins`: Hodges-Tompkins volatility is a bias correction for estimation using an overlapping data sample.\n + `rvol_parkinson`: Parkinson volatility uses the high and low price of the day rather than just close to close prices.\n + `rvol_rogers_satchell`: Rogers-Satchell is an estimator for measuring the volatility with an average return not equal to zero.\n + `rvol_std`: Standard deviation measures how widely returns are dispersed from the average return.\n + `rvol_yang_zhang`: Yang-Zhang volatility is the combination of the overnight (close-to-open volatility).\n `sma`: Gets simple moving average (SMA) for stock\n + `standard_deviation`: Standard deviation measures how widely returns are dispersed from the average return.\n `stoch`: Stochastic oscillator\n `stoch_chart`: Plots stochastic oscillator signal\n `vwap`: Gets volume weighted average price (VWAP)\n @@ -86,6 +87,8 @@ class TaRoot(Category): self.cg_chart = lib.common_ta_momentum_view.display_cg self.clenow = lib.common_ta_momentum_model.clenow_momentum self.clenow_chart = lib.common_ta_momentum_view.display_clenow_momentum + self.cones = lib.common_ta_volatility_model.cones + self.cones_chart = lib.common_ta_volatility_view.display_cones self.demark = lib.common_ta_momentum_model.demark_seq self.demark_chart = lib.common_ta_momentum_view.display_demark self.donchian = lib.common_ta_volatility_model.donchian @@ -106,15 +109,14 @@ class TaRoot(Category): self.obv_chart = lib.common_ta_volume_view.display_obv self.rsi = lib.common_ta_momentum_model.rsi self.rsi_chart = lib.common_ta_momentum_view.display_rsi - self.rvol_std = lib.common_ta_volatility_model.standard_deviation - self.rvol_parkinson = lib.common_ta_volatility_model.parkinson self.rvol_garman_klass = lib.common_ta_volatility_model.garman_klass self.rvol_hodges_tompkins = lib.common_ta_volatility_model.hodges_tompkins + self.rvol_parkinson = lib.common_ta_volatility_model.parkinson self.rvol_rogers_satchell = lib.common_ta_volatility_model.rogers_satchell + self.rvol_std = lib.common_ta_volatility_model.standard_deviation self.rvol_yang_zhang = lib.common_ta_volatility_model.yang_zhang - self.cones = lib.common_ta_volatility_model.cones - self.cones_chart = lib.common_ta_volatility_view.display_cones self.sma = lib.common_ta_overlap_model.sma + self.standard_deviation = lib.common_ta_volatility_model.standard_deviation self.stoch = lib.common_ta_momentum_model.stoch self.stoch_chart = lib.common_ta_momentum_view.display_stoch self.vwap = lib.common_ta_overlap_model.vwap diff --git a/openbb_terminal/core/sdk/trail_map.csv b/openbb_terminal/core/sdk/trail_map.csv index 73e71e7883e..9ba71425e0a 100644 --- a/openbb_terminal/core/sdk/trail_map.csv +++ b/openbb_terminal/core/sdk/trail_map.csv @@ -203,7 +203,7 @@ economy.search_index,economy_yfinance_model.get_search_indices, economy.spectrum,economy_finviz_view.display_spectrum, 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.cpi,economy_fred_model.get_cpi,economy_fred_view.plot_cpi economy.usbonds,economy_wsj_model.us_bonds, economy.valuation,economy_finviz_model.get_valuation_data, etf.candle,stocks_helper.display_candle, @@ -554,11 +554,12 @@ ta.macd,common_ta_momentum_model.macd,common_ta_momentum_view.display_macd ta.obv,common_ta_volume_model.obv,common_ta_volume_view.display_obv ta.rsi,common_ta_momentum_model.rsi,common_ta_momentum_view.display_rsi ta.rvol_garman_klass,common_ta_volatility_model.garman_klass, -ta.rvol_hodges_tompkins,common_ta_volatility_model.rvol_hodges_tompkins, -ta.rvol_parkinson,common_ta_volatility_model.rvol_parkinson, -ta.rvol_rogers_satchell,common_ta_volatility_model.rvol_rogers_satchell, -ta.rvol_std,common_ta_volatility_model.rvol_standard_deviation, -ta.rvol_yang_zhang,common_ta_volatility_model.rvol_yang_zhang, +ta.rvol_hodges_tompkins,common_ta_volatility_model.hodges_tompkins, +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.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 diff --git a/openbb_terminal/sdk.py b/openbb_terminal/sdk.py index 0dfe98f8e2d..08da39fa82a 100644 --- a/openbb_terminal/sdk.py +++ b/openbb_terminal/sdk.py @@ -137,6 +137,8 @@ class OpenBBSDK: `bigmac`: Display Big Mac Index for given countries\n `bigmac_chart`: Display Big Mac Index for given countries\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 `currencies`: Scrape data for global currencies\n `events`: Get economic calendar for countries between specified dates\n `fred`: Get Series data. [Source: FRED]\n @@ -511,6 +513,8 @@ class OpenBBSDK: `cg_chart`: Plots center of gravity Indicator\n `clenow`: Gets the Clenow Volatility Adjusted Momentum. this is defined as the regression coefficient on log prices\n `clenow_chart`: Prints table and plots clenow momentum\n + `cones`: Returns a DataFrame of realized volatility quantiles.\n + `cones_chart`: Plots the realized volatility quantiles for the loaded ticker.\n `demark`: Get the integer value for demark sequential indicator\n `demark_chart`: Plot demark sequential indicator\n `donchian`: Calculate Donchian Channels\n @@ -531,7 +535,14 @@ class OpenBBSDK: `obv_chart`: Plots OBV technical indicator\n `rsi`: Relative strength index\n `rsi_chart`: Plots RSI Indicator\n + `rvol_garman_klass`: Garman-Klass volatility extends Parkinson volatility by taking into account the opening and closing price.\n + `rvol_hodges_tompkins`: Hodges-Tompkins volatility is a bias correction for estimation using an overlapping data sample.\n + `rvol_parkinson`: Parkinson volatility uses the high and low price of the day rather than just close to close prices.\n + `rvol_rogers_satchell`: Rogers-Satchell is an estimator for measuring the volatility with an average return not equal to zero.\n + `rvol_std`: Standard deviation measures how widely returns are dispersed from the average return.\n + `rvol_yang_zhang`: Yang-Zhang volatility is the combination of the overnight (close-to-open volatility).\n `sma`: Gets simple moving average (SMA) for stock\n + `standard_deviation`: Standard deviation measures how widely returns are dispersed from the average return.\n `stoch`: Stochastic oscillator\n `stoch_chart`: Plots stochastic oscillator signal\n `vwap`: Gets volume weighted average price (VWAP)\n