From 380d5c13dd06d37085a9fa3d5bbb6626518dd09c Mon Sep 17 00:00:00 2001 From: Jamie Date: Sat, 22 May 2021 11:06:37 -0400 Subject: [PATCH] Remove NaNs in table, add pyupgrade/Detect private key/ check merge conflicts to pre commit --- .pre-commit-config.yaml | 7 ++++ gamestonk_terminal/etf/README.md | 40 +++++++++---------- gamestonk_terminal/etf/stockanalysis_model.py | 4 ++ 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29a1f38c2d3..99d41888b27 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,6 +5,8 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace + - id: check-merge-conflict + - id: detect-private-key - repo: https://github.com/psf/black rev: 21.4b2 hooks: @@ -36,3 +38,8 @@ repos: - id: detect-secrets args: [ '--baseline', '.secrets.baseline' ] exclude: package.lock.json + - repo: https://github.com/asottile/pyupgrade + rev: v2.18.1 + hooks: + - id: pyupgrade + args: [ --py36-plus ] diff --git a/gamestonk_terminal/etf/README.md b/gamestonk_terminal/etf/README.md index e2fd6a6894c..b1239eead50 100644 --- a/gamestonk_terminal/etf/README.md +++ b/gamestonk_terminal/etf/README.md @@ -86,25 +86,25 @@ Campares the overview of different ETFs. Unknown tickers show nan Example: ``` -(✨) (etf)> compare spy,qqq,voo,DOGE +(✨) (etf)> compare spy,qqq,voo,doge DOGE not found -╒════════════════╤══════════╤══════════╤══════════╤════════╕ -│ │ SPY │ QQQ │ VOO │ DOGE │ -╞════════════════╪══════════╪══════════╪══════════╪════════╡ -│ Last Price │ $414.94 │ $327.01 │ $381.47 │ nan │ -├────────────────┼──────────┼──────────┼──────────┼────────┤ -│ Assets │ $352.93B │ $153.76B │ $219.80B │ nan │ -├────────────────┼──────────┼──────────┼──────────┼────────┤ -│ NAV │ $410.85 │ $322.66 │ $377.68 │ nan │ -├────────────────┼──────────┼──────────┼──────────┼────────┤ -│ Expense Ratio │ 0.09% │ 0.20% │ 0.03% │ nan │ -├────────────────┼──────────┼──────────┼──────────┼────────┤ -│ PE Ratio │ 25.16 │ 35.32 │ 27.60 │ nan │ -├────────────────┼──────────┼──────────┼──────────┼────────┤ -│ Beta (5Y) │ 0.99 │ 1.04 │ 0.99 │ nan │ -├────────────────┼──────────┼──────────┼──────────┼────────┤ -│ Dividend (ttm) │ $5.56 │ $1.77 │ $5.39 │ nan │ -├────────────────┼──────────┼──────────┼──────────┼────────┤ -│ Dividend Yield │ 1.35% │ 0.55% │ 1.43% │ nan │ -╘════════════════╧══════════╧══════════╧══════════╧════════╛ +╒════════════════╤══════════╤══════════╤══════════╕ +│ │ SPY │ QQQ │ VOO │ +╞════════════════╪══════════╪══════════╪══════════╡ +│ Last Price │ $414.94 │ $327.01 │ $381.47 │ +├────────────────┼──────────┼──────────┼──────────┤ +│ Assets │ $353.25B │ $157.51B │ $222.38B │ +├────────────────┼──────────┼──────────┼──────────┤ +│ NAV │ $415.21 │ $328.91 │ $381.70 │ +├────────────────┼──────────┼──────────┼──────────┤ +│ Expense Ratio │ 0.09% │ 0.20% │ 0.03% │ +├────────────────┼──────────┼──────────┼──────────┤ +│ PE Ratio │ 25.16 │ 35.32 │ 27.60 │ +├────────────────┼──────────┼──────────┼──────────┤ +│ Beta (5Y) │ 0.99 │ 1.04 │ 0.99 │ +├────────────────┼──────────┼──────────┼──────────┤ +│ Dividend (ttm) │ $5.56 │ $1.77 │ $5.39 │ +├────────────────┼──────────┼──────────┼──────────┤ +│ Dividend Yield │ 1.34% │ 0.54% │ 1.41% │ +╘════════════════╧══════════╧══════════╧══════════╛ ``` diff --git a/gamestonk_terminal/etf/stockanalysis_model.py b/gamestonk_terminal/etf/stockanalysis_model.py index a76a36e7ddc..9fbaead7849 100644 --- a/gamestonk_terminal/etf/stockanalysis_model.py +++ b/gamestonk_terminal/etf/stockanalysis_model.py @@ -120,6 +120,7 @@ def etf_overview(other_args: List[str]): value.append(row.text) df = pd.DataFrame(value, index=column, columns=[ns_parser.name.upper()]) print(tabulate(df, headers=df.columns, tablefmt="fancy_grid")) + print("") return "" except Exception as e: print(e, "\n") @@ -180,6 +181,7 @@ def etf_holdings(other_args: List[str]): df, headers=["Ticker", "% of ETF", "Shares"], tablefmt="fancy_grid" ) ) + print("") return "" except Exception as e: @@ -240,8 +242,10 @@ def compare_etfs(other_args: List[str]): df[etf] = value else: print(f"{etf} not found") + df = df.drop(etf, axis=1) df.index = column print(tabulate(df, headers=df.columns, tablefmt="fancy_grid")) + print("") return "" except Exception as e: print(e, "\n")