From 7f7cec8451c5a424e9480ab00e0eb3e313d606ca Mon Sep 17 00:00:00 2001 From: Jamie Date: Sun, 2 May 2021 16:03:15 -0400 Subject: [PATCH] formatting fixes round 1 --- gamestonk_terminal/cryptocurrency/README.md | 12 ++++----- .../cryptocurrency/binance_model.py | 23 ++++++++-------- .../cryptocurrency/crypto_controller.py | 27 +++++++++---------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/gamestonk_terminal/cryptocurrency/README.md b/gamestonk_terminal/cryptocurrency/README.md index 882e2756a51..12dfbf737b4 100644 --- a/gamestonk_terminal/cryptocurrency/README.md +++ b/gamestonk_terminal/cryptocurrency/README.md @@ -10,8 +10,8 @@ This menu aims to explore crypto world, and the usage of the following commands * show the top 7 coins from coingecko * [top](#top) * view top coins from coinmarketcap [coinmarketcap.com] -* [add](#add) - * add a coin/currency pair for Binance +* [select](#select) + * select a coin/currency pair for Binance * [book](#book) * get and show market (order) book @@ -68,17 +68,17 @@ This command displays the top n cryptocurrencies from coinmarketcap.com. crypto -## add -Add a coin/currency to the current object. Note that in binance, the exchange "ticker" is usually COINCURR, such as BTCEUR +## select +Select a coin/currency to the current object. Note that in binance, the exchange "ticker" is usually COINCURR, such as BTCEUR for BTC to EURO. There is no USD, but it uses a coin tethered to the USD (USDT), which is the default. Some symbols are a combination of coins, as `ETHBTC` is a valid symbol ```` -usage: add [-c --coin] [-q --quote] +usage: select [-c --coin] [-q --quote] ```` * -c/--coin Coin to load. If not specified, BTC will be loaded to prevent errors later. * -q/--quote Quote currency. Defaults to `USDT` (which is 1-to-1 with USD) -Note that the usage `load btc` will also work, as it will add `-c` if not detected. +Note that the usage `select btc` will also work, as it will add `-c` if not detected. ## book Gets and shows the order book for the given coin/currency. Shows the cumulative amount of orders. diff --git a/gamestonk_terminal/cryptocurrency/binance_model.py b/gamestonk_terminal/cryptocurrency/binance_model.py index 033a2b6499d..29f482e1ca6 100644 --- a/gamestonk_terminal/cryptocurrency/binance_model.py +++ b/gamestonk_terminal/cryptocurrency/binance_model.py @@ -25,11 +25,10 @@ def check_valid_binance_str(symbol: str) -> str : # pylint: disable=inconsistent-return-statements - - -def add_binance_coin(other_args: List[str]): +def select_binance_coin(other_args: List[str]): """ Define current_coin from binance + Parameters ---------- other_args: List[str] @@ -41,7 +40,7 @@ def add_binance_coin(other_args: List[str]): Coin that is defined on binance """ parser = argparse.ArgumentParser( - prog="add_coin", + prog="select", add_help=False, description="Define the coin to be used from binance", ) @@ -66,17 +65,18 @@ def add_binance_coin(other_args: List[str]): coin = ns_parser.coin + ns_parser.quote if check_valid_binance_str(coin): + print(f"{ns_parser.coin.upper()} loaded vs {ns_parser.quote.upper()}") return ns_parser.coin.upper(), ns_parser.quote.upper() except Exception as e: - print(e) - print("") + print(e, "\n") return None, None def order_book(coin: str, other_args: List[str]): """ Get order book for currency + Parameters ---------- coin: str @@ -115,13 +115,13 @@ def order_book(coin: str, other_args: List[str]): plot_order_book(bids, asks, coin) except Exception as e: - print(e) - print("") + print(e, "\n") def show_candles(coin: str, other_args: List[str]): """ Get klines/candles for coin + Parameters ---------- coin: str @@ -219,13 +219,13 @@ def show_candles(coin: str, other_args: List[str]): ) except Exception as e: - print(e) - print("") + print(e, "\n") def balance(coin: str): """ Get account holdings for asset + Parameters ---------- coin: str @@ -248,6 +248,5 @@ def balance(coin: str): print("") return except Exception as e: - print(e) - print("") + print(e, "\n") return diff --git a/gamestonk_terminal/cryptocurrency/crypto_controller.py b/gamestonk_terminal/cryptocurrency/crypto_controller.py index c58da931f3f..7789b0b170a 100644 --- a/gamestonk_terminal/cryptocurrency/crypto_controller.py +++ b/gamestonk_terminal/cryptocurrency/crypto_controller.py @@ -29,7 +29,7 @@ class CryptoController: "trades", "candle", "balance", - "add", + "select", ] def __init__(self): @@ -59,7 +59,7 @@ class CryptoController: print(" top view top coins from coinmarketcap") print("") print("Binance:") - print(" add add coin as current") + print(" select select coin/currency to use") print(" book show order book") print(" candle get klines/candles and plot") print(" balance show coin balance") @@ -94,11 +94,11 @@ class CryptoController: return True def call_load(self, other_args): - """Load command - get df from gecko""" + """Process load command""" self.current_coin, self.current_df = pycoingecko_view.load(other_args) def call_view(self, other_args): - """View command - plot loaded coin""" + """Process view command""" if self.current_coin: pycoingecko_view.view(self.current_coin, self.current_df, other_args) @@ -107,39 +107,38 @@ class CryptoController: print("") def call_trend(self, _): - """Trend command - show top 7 gecko coins""" + """Process trend command""" pycoingecko_view.trend() def call_top(self, other_args): - """Top command - get top n coins from coinmarketcap""" + """Process top command""" cmc_view.get_cmc_top_n(other_args) def call_book(self, other_args): - """Book command - get order book from binance""" + """Process book command""" binance_model.order_book(self.current_coin + self.current_currency, other_args) def call_candle(self, other_args): - """Candle command - show candle chart from binance""" + """Process candle command""" binance_model.show_candles( self.current_coin + self.current_currency, other_args ) def call_balance(self, _): - """Balance command - check current holdings of coin in binance""" + """Process balance command""" binance_model.balance(self.current_coin) - def call_add(self, other_args): - """Add command - set current coin for binance operations""" - self.current_coin, self.current_currency = binance_model.add_binance_coin( + def call_select(self, other_args): + """Process select command""" + self.current_coin, self.current_currency = binance_model.select_binance_coin( other_args ) - print(f"{self.current_coin} loaded vs {self.current_currency}") print("") def menu(): crypto_controller = CryptoController() - crypto_controller.print_help(crypto_controller) + crypto_controller.print_help(None) plt.close("all") while True: # Get input command from user