From 564d08edd8714ae13c126afa4760b9e15af24e0f Mon Sep 17 00:00:00 2001 From: Pratyush Shukla Date: Fri, 4 Aug 2023 23:25:47 +0530 Subject: [PATCH] add `--india` flag to `stocks/load` (#5281) * add `--india` flag to `stocks/load` Add ticker, set `india` and voila! * updated "help" * added check for `.ns`, `.NS` in ticker * consolidated conditions into 1 line --- openbb_terminal/parent_classes.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openbb_terminal/parent_classes.py b/openbb_terminal/parent_classes.py index 7de223ec76b..f3600597df5 100644 --- a/openbb_terminal/parent_classes.py +++ b/openbb_terminal/parent_classes.py @@ -1485,6 +1485,13 @@ class StockBaseController(BaseController, metaclass=ABCMeta): default=False, help="Show performance information.", ) + parser.add_argument( + "--india", + dest="india", + action="store_true", + default=False, + help="Only works for yf source, when the ticker has .NS suffix as part of it.", + ) if other_args and "-" not in other_args[0][0]: other_args.insert(0, "-t") @@ -1498,6 +1505,8 @@ class StockBaseController(BaseController, metaclass=ABCMeta): "[red]Only one of monthly or weekly can be selected.[/red]." ) return + if ns_parser.india and not ns_parser.ticker.endswith((".ns", ".NS")): + ns_parser.ticker = ns_parser.ticker + ".NS" if ns_parser.filepath is None: df_stock_candidate = stocks_helper.load( ns_parser.ticker,