diff --git a/gamestonk_terminal/stocks/stocks_helper.py b/gamestonk_terminal/stocks/stocks_helper.py index 26ac09f5be3..c97587a18e3 100644 --- a/gamestonk_terminal/stocks/stocks_helper.py +++ b/gamestonk_terminal/stocks/stocks_helper.py @@ -284,7 +284,6 @@ def load( df_stock_candidate = yf.download( ns_parser.s_ticker, start=ns_parser.s_start_date, - end=ns_parser.s_end_date, progress=False, ) @@ -699,6 +698,16 @@ def quote(other_args: List[str], s_ticker: str): help="Stock ticker", ) + # Price only option. + parser.add_argument( + "-p", + "--price", + action="store_true", + dest="price_only", + default=False, + help="Price only", + ) + try: # For the case where a user uses: 'quote BB' if other_args and "-" not in other_args[0]: @@ -713,6 +722,11 @@ def quote(other_args: List[str], s_ticker: str): ticker = yf.Ticker(ns_parser.s_ticker) + # If price only option, return immediate market price for ticker. + if ns_parser.price_only: + print(f"Price of {ns_parser.s_ticker} {ticker.info['regularMarketPrice']}") + return + try: quote_df = pd.DataFrame( [ @@ -761,6 +775,7 @@ def quote(other_args: List[str], s_ticker: str): stralign="right", ) ) + except KeyError: print(f"Invalid stock ticker: {ns_parser.s_ticker}") diff --git a/website/content/stocks/quote/_index.md b/website/content/stocks/quote/_index.md index 1a9314dfd64..d1f13029c59 100755 --- a/website/content/stocks/quote/_index.md +++ b/website/content/stocks/quote/_index.md @@ -1,5 +1,5 @@ ``` -usage: quote [-t S_TICKER] [-h] +usage: quote [-t S_TICKER] [-p] [-h] ``` Retrieves a current quote from the currently [loaded ticker](https://gamestonkterminal.github.io/GamestonkTerminal/stocks/load/). To view a quote from a different symbol than what is currently loaded, add the '-t' argument to the command string. @@ -8,6 +8,7 @@ Retrieves a current quote from the currently [loaded ticker](https://gamestonkte optional arguments: -t S_TICKER, --ticker S_TICKER Stock ticker (default: AAPL) + -p, --price Return only the current price (default: False) -h, --help show this help message (default: False) ```