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
This commit is contained in:
Pratyush Shukla
2023-08-04 23:25:47 +05:30
committed by GitHub
parent f1eee44cab
commit 564d08edd8

View File

@@ -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,