Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the UI a little cleaner #4405

Merged
merged 4 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions openbb_terminal/stocks/backtesting/bt_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ def __init__(
def print_help(self):
"""Print help"""
mt = MenuText("stocks/bt/")
mt.add_raw("")
mt.add_param("_ticker", self.ticker.upper() or "No Ticker Loaded")
mt.add_raw("\n")
mt.add_param("_ticker", self.ticker.upper())
mt.add_cmd("load")
mt.add_raw("\n")
mt.add_cmd("whatif")
mt.add_cmd("whatif", self.ticker)
mt.add_raw("\n")
mt.add_cmd("ema")
mt.add_cmd("emacross")
mt.add_cmd("rsi")
mt.add_cmd("ema", self.ticker)
mt.add_cmd("emacross", self.ticker)
mt.add_cmd("rsi", self.ticker)
console.print(text=mt.menu_text, menu="Stocks - Backtesting")

def custom_reset(self):
Expand Down
3 changes: 2 additions & 1 deletion openbb_terminal/stocks/comparison_analysis/ca_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ def call_get(self, other_args: List[str]):
)
else:
console.print(
"You need to 'set' a ticker to get similar companies from first!"
"You need to 'set' a ticker to get similar companies from first! This is "
"for example done by running 'ticker aapl'"
)

@log_start_end(log=logger)
Expand Down
89 changes: 88 additions & 1 deletion openbb_terminal/stocks/fundamental_analysis/fa_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@

logger = logging.getLogger(__name__)

no_ticker_message = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the cmds under this menu also be grey if ticker is not loaded?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the reason they aren't is because they can all be run with cmd -t

"No ticker loaded. Use 'load' command to load a ticker or use the -t flag."
)


class FundamentalAnalysisController(StockBaseController):
"""Fundamental Analysis Controller class"""
Expand Down Expand Up @@ -199,6 +203,9 @@ def call_analysis(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return
eclect_us_view.display_analysis(
symbol=self.ticker,
export=ns_parser.export,
Expand Down Expand Up @@ -235,6 +242,9 @@ def call_mgmt(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return
business_insider_view.display_management(
symbol=self.ticker,
export=ns_parser.export,
Expand Down Expand Up @@ -270,6 +280,9 @@ def call_overview(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return
if ns_parser.source == "Finviz":
finviz_view.display_screen_data(
symbol=self.ticker,
Expand Down Expand Up @@ -338,7 +351,9 @@ def call_score(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])

if not self.ticker:
console.print(no_ticker_message)
return
fmp_view.valinvest_score(
self.ticker,
ns_parser.years,
Expand Down Expand Up @@ -405,6 +420,9 @@ def call_enterprise(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

if ns_parser.source == "FinancialModelingPrep":
fmp_view.display_enterprise(
Expand Down Expand Up @@ -485,6 +503,9 @@ def call_metrics(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

if ns_parser.source == "FinancialModelingPrep":
fmp_view.display_key_metrics(
Expand Down Expand Up @@ -565,6 +586,9 @@ def call_ratios(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

fmp_view.display_financial_ratios(
symbol=self.ticker,
Expand Down Expand Up @@ -632,6 +656,9 @@ def call_growth(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

fmp_view.display_financial_statement_growth(
symbol=self.ticker,
Expand Down Expand Up @@ -668,6 +695,9 @@ def call_epsfc(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

seeking_alpha_view.display_eps_estimates(
self.ticker,
Expand Down Expand Up @@ -702,6 +732,9 @@ def call_revfc(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

seeking_alpha_view.display_rev_estimates(
self.ticker,
Expand Down Expand Up @@ -735,6 +768,9 @@ def call_splits(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

yahoo_finance_view.display_splits(
self.ticker,
Expand Down Expand Up @@ -780,6 +816,9 @@ def call_shrs(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

if not self.suffix:
yahoo_finance_view.display_shareholders(
Expand Down Expand Up @@ -833,6 +872,9 @@ def call_divs(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

if not self.suffix:
yahoo_finance_view.display_dividends(
Expand Down Expand Up @@ -910,6 +952,9 @@ def call_income(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

ns_parser.plot = list_from_str(ns_parser.plot)
# TODO: Switch to actually getting data
Expand Down Expand Up @@ -1053,6 +1098,9 @@ def call_balance(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

ns_parser.plot = list_from_str(ns_parser.plot)
# TODO: Switch to actually getting data
Expand Down Expand Up @@ -1200,6 +1248,9 @@ def call_cash(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

ns_parser.plot = list_from_str(ns_parser.plot)
# TODO: Switch to actually getting data
Expand Down Expand Up @@ -1318,6 +1369,9 @@ def call_earnings(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

if ns_parser.source == "AlphaVantage":
av_view.display_earnings(
Expand Down Expand Up @@ -1412,6 +1466,9 @@ def call_fraud(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

av_view.display_fraud(
symbol=self.ticker,
Expand Down Expand Up @@ -1453,6 +1510,9 @@ def call_dupont(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

av_view.display_dupont(
self.ticker, raw=ns_parser.raw, export=ns_parser.export
Expand Down Expand Up @@ -1555,6 +1615,9 @@ def call_dcf(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

if self.ticker:
dcf = dcf_view.CreateExcelFA(
Expand Down Expand Up @@ -1615,6 +1678,9 @@ def call_dcfc(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

fmp_view.display_discounted_cash_flow(
symbol=self.ticker,
Expand Down Expand Up @@ -1732,6 +1798,9 @@ def call_pt(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

business_insider_view.price_target_from_analysts(
symbol=self.ticker,
Expand Down Expand Up @@ -1777,6 +1846,9 @@ def call_est(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

business_insider_view.estimates(
symbol=self.ticker,
Expand Down Expand Up @@ -1831,6 +1903,9 @@ def call_rot(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

finnhub_view.rating_over_time(
symbol=self.ticker,
Expand Down Expand Up @@ -1882,6 +1957,9 @@ def call_rating(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

if ns_parser.source == "Finviz":
finviz_view.analyst(
Expand Down Expand Up @@ -1949,6 +2027,9 @@ def call_sec(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

if ns_parser.source == "MarketWatch":
marketwatch_view.sec_filings(
Expand Down Expand Up @@ -1994,6 +2075,9 @@ def call_supplier(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

csimarket_view.suppliers(
symbol=self.ticker,
Expand Down Expand Up @@ -2027,6 +2111,9 @@ def call_customer(self, other_args: List[str]):
if ns_parser.ticker:
self.ticker = ns_parser.ticker
self.custom_load_wrapper([self.ticker])
if not self.ticker:
console.print(no_ticker_message)
return

csimarket_view.customers(
symbol=self.ticker,
Expand Down
54 changes: 28 additions & 26 deletions openbb_terminal/stocks/quantitative_analysis/qa_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,40 +114,42 @@ def print_help(self):

mt = MenuText("stocks/qa/")
mt.add_cmd("load")
mt.add_cmd("pick")
mt.add_cmd("pick", not self.stock.empty)
mt.add_raw("\n")
mt.add_param("_ticker", stock_str)
mt.add_param(
"_ticker", stock_str if not self.stock.empty else "No ticker loaded"
)
mt.add_param("_target", self.target)
mt.add_raw("\n")
mt.add_info("_statistics_")
mt.add_cmd("summary")
mt.add_cmd("normality")
mt.add_cmd("unitroot")
mt.add_cmd("summary", not self.stock.empty)
mt.add_cmd("normality", not self.stock.empty)
mt.add_cmd("unitroot", not self.stock.empty)
mt.add_info("_plots_")
mt.add_cmd("line")
mt.add_cmd("hist")
mt.add_cmd("cdf")
mt.add_cmd("bw")
mt.add_cmd("acf")
mt.add_cmd("qqplot")
mt.add_cmd("line", not self.stock.empty)
mt.add_cmd("hist", not self.stock.empty)
mt.add_cmd("cdf", not self.stock.empty)
mt.add_cmd("bw", not self.stock.empty)
mt.add_cmd("acf", not self.stock.empty)
mt.add_cmd("qqplot", not self.stock.empty)
mt.add_info("_rolling_metrics_")
mt.add_cmd("rolling")
mt.add_cmd("spread")
mt.add_cmd("quantile")
mt.add_cmd("skew")
mt.add_cmd("kurtosis")
mt.add_cmd("rolling", not self.stock.empty)
mt.add_cmd("spread", not self.stock.empty)
mt.add_cmd("quantile", not self.stock.empty)
mt.add_cmd("skew", not self.stock.empty)
mt.add_cmd("kurtosis", not self.stock.empty)
mt.add_info("_risk_")
mt.add_cmd("var")
mt.add_cmd("es")
mt.add_cmd("sh")
mt.add_cmd("so")
mt.add_cmd("om")
mt.add_cmd("var", not self.stock.empty)
mt.add_cmd("es", not self.stock.empty)
mt.add_cmd("sh", not self.stock.empty)
mt.add_cmd("so", not self.stock.empty)
mt.add_cmd("om", not self.stock.empty)
mt.add_info("_other_")
mt.add_cmd("raw")
mt.add_cmd("decompose")
mt.add_cmd("cusum")
mt.add_cmd("capm")
mt.add_cmd("beta")
mt.add_cmd("raw", not self.stock.empty)
mt.add_cmd("decompose", not self.stock.empty)
mt.add_cmd("cusum", not self.stock.empty)
mt.add_cmd("capm", not self.stock.empty)
mt.add_cmd("beta", not self.stock.empty)
console.print(text=mt.menu_text, menu="Stocks - Quantitative Analysis")

def custom_reset(self):
Expand Down
Loading