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

Added fix #4710

Merged
merged 11 commits into from
Apr 10, 2023
27 changes: 10 additions & 17 deletions openbb_terminal/cryptocurrency/crypto_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def call_prt(self, other_args):
help="Coin to compare with",
dest="vs",
type=str,
# required="-h" not in other_args,
required="-h" not in other_args and "--help" not in other_args,
default=None,
)
parser.add_argument(
Expand All @@ -187,11 +187,9 @@ def call_prt(self, other_args):
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--vs")

ns_parser = self.parse_known_args_and_warn(
if ns_parser := self.parse_known_args_and_warn(
parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED
)

if ns_parser:
):
if self.symbol:
num_args = 0
for arg in vars(ns_parser):
Expand Down Expand Up @@ -240,7 +238,7 @@ def call_price(self, other_args):
parser.add_argument(
"-s",
"--symbol",
required="-h" not in other_args,
required="-h" not in other_args and "--help" not in other_args,
type=str,
dest="symbol",
help="Symbol of coin to load data for, ~100 symbols are available",
Expand All @@ -250,9 +248,7 @@ def call_price(self, other_args):
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-s")

ns_parser = self.parse_known_args_and_warn(parser, other_args)

if ns_parser:
if ns_parser := self.parse_known_args_and_warn(parser, other_args):
upper_symbol = ns_parser.symbol.upper()
if "-USD" not in ns_parser.symbol:
upper_symbol += "-USD"
Expand Down Expand Up @@ -283,10 +279,9 @@ def call_candle(self, other_args):
dest="logy",
)

ns_parser = self.parse_known_args_and_warn(
if ns_parser := self.parse_known_args_and_warn(
parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES
)
if ns_parser:
):
if not self.symbol:
console.print("No coin loaded. First use `load {symbol}`\n")
return
Expand Down Expand Up @@ -385,11 +380,9 @@ def call_headlines(self, other_args):
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-c")
ns_parser = self.parse_known_args_and_warn(
if ns_parser := self.parse_known_args_and_warn(
parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES
)

if ns_parser:
):
finbrain_crypto_view.display_crypto_sentiment_analysis(
symbol=ns_parser.coin, export=ns_parser.export
)
Expand Down Expand Up @@ -474,7 +467,7 @@ def call_find(self, other_args):
"--coin",
help="Symbol Name or Id of Coin",
dest="coin",
required="-h" not in other_args,
required="-h" not in other_args and "--help" not in other_args,
type=str,
)
parser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion openbb_terminal/parent_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ def call_load(self, other_args):
help="Coin to get. Must be coin symbol (e.g., btc, eth)",
dest="coin",
type=str,
required="-h" not in other_args,
required="-h" not in other_args and "--help" not in other_args,
)

parser.add_argument(
Expand Down