From dc43b18e6e0d148874c3c091acd68827edc4f87f Mon Sep 17 00:00:00 2001 From: Pratyush Shukla Date: Fri, 7 Apr 2023 17:34:18 +0530 Subject: [PATCH 1/3] Added fix --- openbb_terminal/cryptocurrency/crypto_controller.py | 4 ++-- openbb_terminal/parent_classes.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openbb_terminal/cryptocurrency/crypto_controller.py b/openbb_terminal/cryptocurrency/crypto_controller.py index 451c40f0249d..55340ce603ee 100644 --- a/openbb_terminal/cryptocurrency/crypto_controller.py +++ b/openbb_terminal/cryptocurrency/crypto_controller.py @@ -240,7 +240,7 @@ def call_price(self, other_args): parser.add_argument( "-s", "--symbol", - required="-h" not in other_args, + # required="-h" not in other_args, type=str, dest="symbol", help="Symbol of coin to load data for, ~100 symbols are available", @@ -474,7 +474,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, type=str, ) parser.add_argument( diff --git a/openbb_terminal/parent_classes.py b/openbb_terminal/parent_classes.py index 4076cf1c1724..a839b6cf5b90 100644 --- a/openbb_terminal/parent_classes.py +++ b/openbb_terminal/parent_classes.py @@ -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, ) parser.add_argument( From b51b839ba34a8355cba842b27b3c107481171021 Mon Sep 17 00:00:00 2001 From: Pratyush Shukla Date: Sun, 9 Apr 2023 16:46:31 +0530 Subject: [PATCH 2/3] Fixed `load`, `find`, `price` and refactored code --- .../cryptocurrency/crypto_controller.py | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/openbb_terminal/cryptocurrency/crypto_controller.py b/openbb_terminal/cryptocurrency/crypto_controller.py index 55340ce603ee..c97a4cd11b5c 100644 --- a/openbb_terminal/cryptocurrency/crypto_controller.py +++ b/openbb_terminal/cryptocurrency/crypto_controller.py @@ -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( @@ -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): @@ -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", @@ -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" @@ -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 @@ -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 ) @@ -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( From 074f88683456db9d8b9111131e87daec72e47226 Mon Sep 17 00:00:00 2001 From: Pratyush Shukla Date: Sun, 9 Apr 2023 17:21:41 +0530 Subject: [PATCH 3/3] Modified line 1304 in parent_classes.py --- openbb_terminal/parent_classes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbb_terminal/parent_classes.py b/openbb_terminal/parent_classes.py index a839b6cf5b90..26c833791dc9 100644 --- a/openbb_terminal/parent_classes.py +++ b/openbb_terminal/parent_classes.py @@ -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(