diff --git a/gamestonk_terminal/cryptocurrency/binance_model.py b/gamestonk_terminal/cryptocurrency/binance_model.py index 2d69f8d669f..5304d527dc0 100644 --- a/gamestonk_terminal/cryptocurrency/binance_model.py +++ b/gamestonk_terminal/cryptocurrency/binance_model.py @@ -73,15 +73,17 @@ def select_binance_coin(other_args: List[str]): return None, None -def order_book(coin: str, other_args: List[str]): +def order_book(other_args: List[str], coin: str, currency: str): """Get order book for currency Parameters ---------- - coin: str - Coin to get order book for other_args: List[str] Argparse arguments + coin: str + Coin to get symbol of + currency : str + Currency against which to check symbol """ limit_list = [5, 10, 20, 50, 100, 500, 1000, 5000] parser = argparse.ArgumentParser( @@ -98,6 +100,12 @@ def order_book(coin: str, other_args: List[str]): ) try: + if not coin or not currency: + print("Coin needs to be selected prior to this command\n") + return + else: + coin += currency + ns_parser = parse_known_args_and_warn(parser, other_args) if not ns_parser: return @@ -113,16 +121,17 @@ def order_book(coin: str, other_args: List[str]): print(e, "\n") -def show_candles(coin: str, other_args: List[str]): +def show_candles(other_args: List[str], coin: str, currency: str): """Get klines/candles for coin Parameters ---------- - coin: str - Coin to get symbol of other_args: List[str] Argparse arguments - + coin: str + Coin to get symbol of + currency : str + Currency against which to check symbol """ client = Client(cfg.API_BINANCE_KEY, cfg.API_BINANCE_SECRET) @@ -165,9 +174,16 @@ def show_candles(coin: str, other_args: List[str]): ) try: + if not coin or not currency: + print("Coin needs to be selected prior to this command\n") + return + else: + coin += currency + ns_parser = parse_known_args_and_warn(parser, other_args) if not ns_parser: return + candles = client.get_klines( symbol=coin, interval=interval_map[ns_parser.interval], diff --git a/gamestonk_terminal/cryptocurrency/crypto_controller.py b/gamestonk_terminal/cryptocurrency/crypto_controller.py index 60a9359631c..958b345f5d5 100644 --- a/gamestonk_terminal/cryptocurrency/crypto_controller.py +++ b/gamestonk_terminal/cryptocurrency/crypto_controller.py @@ -115,13 +115,11 @@ class CryptoController: def call_book(self, other_args): """Process book command""" - binance_model.order_book(self.current_coin + self.current_currency, other_args) + binance_model.order_book(other_args, self.current_coin, self.current_currency) def call_candle(self, other_args): """Process candle command""" - binance_model.show_candles( - self.current_coin + self.current_currency, other_args - ) + binance_model.show_candles(other_args, self.current_coin, self.current_currency) def call_balance(self, _): """Process balance command"""