From d3cb2e90435c1e1aa89e660c90bf7db191698dfc Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Sat, 27 Feb 2021 14:55:41 -0800 Subject: [PATCH] Markdown and Pylint linting --- gamestonk_terminal/discovery/README.md | 114 ++++++++++-------- .../discovery/alpha_vantage_api.py | 6 +- gamestonk_terminal/discovery/disc_menu.py | 1 - gamestonk_terminal/discovery/spachero_api.py | 2 +- .../discovery/unusual_whales_api.py | 2 +- .../due_diligence/business_insider_api.py | 4 - gamestonk_terminal/due_diligence/dd_menu.py | 10 -- .../financial_modeling_prep_api.py | 17 ++- .../due_diligence/finviz_api.py | 25 ++-- .../due_diligence/market_watch_api.py | 14 ++- .../due_diligence/reddit_api.py | 20 ++- 11 files changed, 110 insertions(+), 105 deletions(-) diff --git a/gamestonk_terminal/discovery/README.md b/gamestonk_terminal/discovery/README.md index aa2e00c4d8a..a8de67a3bf4 100644 --- a/gamestonk_terminal/discovery/README.md +++ b/gamestonk_terminal/discovery/README.md @@ -2,123 +2,139 @@ This menu aims to discover new stocks, and the usage of the following commands along with an example will be exploited below. - * [map](#map) - - S&P500 index stocks map [Finviz] - * [sectors](#sectors) - - show sectors performance [Alpha Vantage] - * [gainers](#gainers) - - show latest top gainers [Yahoo Finance] - * [orders](#orders) - - orders by Fidelity Customers [Fidelity] - * [up_earnings](#up_earnings) - - upcoming earnings release dates [Seeking Alpha] - * [high_short](#high_short) - - show top high short interest stocks of over 20% ratio [www.highshortinterest.com] - * [low_float](#low_float) - - show low float stocks under 10M shares float [www.lowfloat.com] - * [simply_wallst](#simply_wallst) - - Simply Wall St. research data [Simply Wall St.] - * [spachero](#spachero) - - great website for SPACs research [SpacHero] - * [uwhales](#uwhales) - - good website for SPACs research [UnusualWhales] +* [map](#map) + * S&P500 index stocks map [Finviz] +* [sectors](#sectors) + * show sectors performance [Alpha Vantage] +* [gainers](#gainers) + * show latest top gainers [Yahoo Finance] +* [orders](#orders) + * orders by Fidelity Customers [Fidelity] +* [up_earnings](#up_earnings) + * upcoming earnings release dates [Seeking Alpha] +* [high_short](#high_short) + * show top high short interest stocks of over 20% ratio [www.highshortinterest.com] +* [low_float](#low_float) + * show low float stocks under 10M shares float [www.lowfloat.com] +* [simply_wallst](#simply_wallst) + * Simply Wall St. research data [Simply Wall St.] +* [spachero](#spachero) + * great website for SPACs research [SpacHero] +* [uwhales](#uwhales) + * good website for SPACs research [UnusualWhales] ## map -``` +```shell usage: map [-p {1d,1w,1m,3m,6m,1y}] [-t {sp500,world,full,etf}] ``` + Performance index stocks map categorized by sectors and industries. Size represents market cap. Opens web-browser. [Source: Finviz] - * -p : Performance period. Default 1 day. - * -t : Map filter type. Default S&P500. + +* -p : Performance period. Default 1 day. +* -t : Map filter type. Default S&P500. ![map_filter](https://user-images.githubusercontent.com/25267873/108570986-032a4800-7307-11eb-8c8d-f62409c11e06.png) - ## sectors -``` + +```shell usage: sectors ``` + Real-time and historical sector performances calculated from S&P500 incumbents. Pops plot in terminal. [Source: Alpha Vantage] ![sectors](https://user-images.githubusercontent.com/25267873/108572267-d297dd80-7309-11eb-863b-20cfe3012c30.png) - ## gainers -``` + +```shell usage: gainers [-n {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}] ``` + Print up to 25 top ticker gainers in terminal. [Source: Yahoo Finance] - * -n : Number of the top gainers stocks to retrieve. Default 5. + +* -n : Number of the top gainers stocks to retrieve. Default 5. Captura de ecrã 2021-02-20, às 11 46 09 - ## orders -``` + +```shell usage: orders [-n N_NUM] ``` + Orders by Fidelity customers. Information shown in the table below is based on the volume of orders entered on the "as of" date shown. Securities identified are not recommended or endorsed by Fidelity and are displayed for informational purposes only. [Source: Fidelity] - * -n : Number of top ordered stocks to be printed. Default 10. + +* -n : Number of top ordered stocks to be printed. Default 10. Captura de ecrã 2021-02-20, às 11 45 43 - ## up_earnings -``` + +```shell usage: up_earnings [-p N_PAGES] [-n N_NUM] ``` + Print upcoming earnings release dates. [Source: Seeking Alpha] - * -p : Number of pages to read upcoming earnings from in Seeking Alpha website. Default 10. - * -n : Number of upcoming earnings release dates to print. Default 3. + +* -p : Number of pages to read upcoming earnings from in Seeking Alpha website. Default 10. +* -n : Number of upcoming earnings release dates to print. Default 3. Captura de ecrã 2021-02-20, às 11 45 24 - ## high_short -``` + +```shell usage: high_short [-n N_NUM] ``` + Print top stocks being more heavily shorted. HighShortInterest.com provides a convenient sorted database of stocks which have a short interest of over 20 percent. Additional key data such as the float, number of outstanding shares, and company industry is displayed. Data is presented for the Nasdaq Stock Market, the New York Stock Exchange, and the American Stock Exchange. Stocks with high short interest are often very volatile and are well known for making explosive upside moves (known as a short squeeze). [Source: www.highshortinterest.com] - * -n : Number of top stocks to print + +* -n : Number of top stocks to print Captura de ecrã 2021-02-20, às 11 45 02 - ## low_float -``` + +```shell usage: low_float [-n N_NUM] ``` + Print top stocks with lowest float. LowFloat.com provides a convenient sorted database of stocks which have a float of under 10 million shares. Additional key data such as the number of outstanding shares, short interest, and company industry is displayed. Data is presented for the Nasdaq Stock Market, the New York Stock Exchange, the American Stock Exchange, and the Over the Counter Bulletin Board. [Source: www.lowfloat.com] - * -n : Number of top stocks to print + +* -n : Number of top stocks to print Captura de ecrã 2021-02-20, às 11 44 39 - ## simply_wallst -``` + +```shell usage: simply_wallst [-i {any,automobiles,banks,capital-goods,commercial-services,consumer-durables,consumer-services,diversified-financials,energy,consumer-retailing,food-beverage-tobacco,healthcare,household,insurance,materials,media,pharmaceuticals-biotech,real-estate,retail,semiconductors,software,tech,telecom,transportation,utilities}] ``` + Simply Wall Street Research. Opens web browser. Although this does not require an API key, it requires a subscription to the website by the user (there's a 14 days free trial). [Source: Simply Wall St.] - * -i : Industry of interest + +* -i : Industry of interest sw - ## spachero -``` + +```shell usage: spachero ``` + Great website for SPACs research. [Source: www.spachero.com] Captura de ecrã 2021-02-20, às 01 12 14 - ## uwhales -``` + +```shell usage: uwhales ``` + Good website for SPACs research. [Source: www.unusualwhales.com] Captura de ecrã 2021-02-20, às 11 38 54 - diff --git a/gamestonk_terminal/discovery/alpha_vantage_api.py b/gamestonk_terminal/discovery/alpha_vantage_api.py index 3c3cf57a46a..3bd1ce70de7 100644 --- a/gamestonk_terminal/discovery/alpha_vantage_api.py +++ b/gamestonk_terminal/discovery/alpha_vantage_api.py @@ -1,5 +1,4 @@ import argparse -import pandas as pd import matplotlib.pyplot as plt from alpha_vantage.sectorperformance import SectorPerformances from gamestonk_terminal import config_terminal as cfg @@ -13,7 +12,7 @@ def sectors(l_args): ) try: - (ns_parser, l_unknown_args) = parser.parse_known_args(l_args) + (_, l_unknown_args) = parser.parse_known_args(l_args) except SystemExit: print("") return @@ -24,7 +23,8 @@ def sectors(l_args): sector_perf = SectorPerformances( key=cfg.API_KEY_ALPHAVANTAGE, output_format="pandas" ) - df_sectors, d_meta_data = sector_perf.get_sector() + df_sectors, _, _ = sector_perf.get_sector() + # pylint: disable=invalid-sequence-index df_sectors["Rank A: Real-Time Performance"].plot(kind="bar") plt.title("Real Time Performance (%) per Sector") plt.tight_layout() diff --git a/gamestonk_terminal/discovery/disc_menu.py b/gamestonk_terminal/discovery/disc_menu.py index 591d335f3d4..c189feeed79 100644 --- a/gamestonk_terminal/discovery/disc_menu.py +++ b/gamestonk_terminal/discovery/disc_menu.py @@ -1,4 +1,3 @@ -from gamestonk_terminal import config_terminal as cfg import argparse from gamestonk_terminal.discovery import alpha_vantage_api from gamestonk_terminal.discovery import yahoo_finance_api diff --git a/gamestonk_terminal/discovery/spachero_api.py b/gamestonk_terminal/discovery/spachero_api.py index 7742ee7d173..ec07035fd36 100644 --- a/gamestonk_terminal/discovery/spachero_api.py +++ b/gamestonk_terminal/discovery/spachero_api.py @@ -9,7 +9,7 @@ def spachero(l_args): ) try: - (ns_parser, l_unknown_args) = parser.parse_known_args(l_args) + (_, l_unknown_args) = parser.parse_known_args(l_args) if l_unknown_args: print(f"The following args couldn't be interpreted: {l_unknown_args}") diff --git a/gamestonk_terminal/discovery/unusual_whales_api.py b/gamestonk_terminal/discovery/unusual_whales_api.py index 7a6274eb36d..8540dcca95b 100644 --- a/gamestonk_terminal/discovery/unusual_whales_api.py +++ b/gamestonk_terminal/discovery/unusual_whales_api.py @@ -9,7 +9,7 @@ def unusual_whales(l_args): ) try: - (ns_parser, l_unknown_args) = parser.parse_known_args(l_args) + (_, l_unknown_args) = parser.parse_known_args(l_args) if l_unknown_args: print(f"The following args couldn't be interpreted: {l_unknown_args}") diff --git a/gamestonk_terminal/due_diligence/business_insider_api.py b/gamestonk_terminal/due_diligence/business_insider_api.py index fc83a4ebf4a..f97ec4b9b46 100644 --- a/gamestonk_terminal/due_diligence/business_insider_api.py +++ b/gamestonk_terminal/due_diligence/business_insider_api.py @@ -1,5 +1,4 @@ import argparse -from datetime import datetime import json import re import requests @@ -7,14 +6,11 @@ import matplotlib.pyplot as plt import pandas as pd from pandas.plotting import register_matplotlib_converters from bs4 import BeautifulSoup -from alpha_vantage.timeseries import TimeSeries -from fuzzywuzzy import fuzz from gamestonk_terminal.helper_funcs import ( check_positive, get_next_stock_market_days, get_user_agent, ) -from gamestonk_terminal import config_terminal as cfg register_matplotlib_converters() diff --git a/gamestonk_terminal/due_diligence/dd_menu.py b/gamestonk_terminal/due_diligence/dd_menu.py index 5dee6f89abb..7cce9eec7f0 100644 --- a/gamestonk_terminal/due_diligence/dd_menu.py +++ b/gamestonk_terminal/due_diligence/dd_menu.py @@ -1,14 +1,4 @@ -import FundamentalAnalysis as fa -from alpha_vantage.fundamentaldata import FundamentalData -from gamestonk_terminal import config_terminal as cfg import argparse -import datetime -from datetime import datetime -from gamestonk_terminal.helper_funcs import * -import pandas as pd -import json -import requests -from pandas.io.json import json_normalize from gamestonk_terminal.due_diligence import finviz_api as fvz_api from gamestonk_terminal.due_diligence import market_watch_api as mw_api diff --git a/gamestonk_terminal/due_diligence/financial_modeling_prep_api.py b/gamestonk_terminal/due_diligence/financial_modeling_prep_api.py index 7b51a6d3d3b..4046d98fe23 100644 --- a/gamestonk_terminal/due_diligence/financial_modeling_prep_api.py +++ b/gamestonk_terminal/due_diligence/financial_modeling_prep_api.py @@ -1,22 +1,20 @@ +import argparse import FundamentalAnalysis as fa # Financial Modeling Prep from gamestonk_terminal import config_terminal as cfg -import argparse -import datetime -from datetime import datetime -from gamestonk_terminal.helper_funcs import * -import pandas as pd # ---------------------------------------------------- RATING ---------------------------------------------------- def rating(l_args, s_ticker): parser = argparse.ArgumentParser( prog="rating", - description="""Based on specific ratios, prints information whether the company - is a (strong) buy, neutral or a (strong) sell. The following fields are expected: - P/B, ROA, DCF, P/E, ROE, and D/E. [Source: Financial Modeling Prep]""", + description=""" + Based on specific ratios, prints information whether the company + is a (strong) buy, neutral or a (strong) sell. The following fields are expected: + P/B, ROA, DCF, P/E, ROE, and D/E. [Source: Financial Modeling Prep] + """, ) try: - (ns_parser, l_unknown_args) = parser.parse_known_args(l_args) + (_, l_unknown_args) = parser.parse_known_args(l_args) if l_unknown_args: print(f"The following args couldn't be interpreted: {l_unknown_args}\n") @@ -30,4 +28,3 @@ def rating(l_args, s_ticker): except: print("") return - diff --git a/gamestonk_terminal/due_diligence/finviz_api.py b/gamestonk_terminal/due_diligence/finviz_api.py index 9d99efc8987..703334b2378 100644 --- a/gamestonk_terminal/due_diligence/finviz_api.py +++ b/gamestonk_terminal/due_diligence/finviz_api.py @@ -1,15 +1,16 @@ -import finviz import argparse -from gamestonk_terminal.helper_funcs import * +import finviz import pandas as pd +from gamestonk_terminal.helper_funcs import check_positive # ---------------------------------------------------- INSIDER ---------------------------------------------------- def insider(l_args, s_ticker): parser = argparse.ArgumentParser( prog="insider", - description="""Prints information about inside traders. The following fields are expected: - Date, Relationship, Transaction, #Shares, Cost, Value ($), #Shares Total, Insider Trading, - SEC Form 4. [Source: Finviz]""", + description=""" + Prints information about inside traders. The following fields are expected: Date, Relationship, + Transaction, #Shares, Cost, Value ($), #Shares Total, Insider Trading, SEC Form 4. [Source: Finviz] + """, ) parser.add_argument( @@ -57,8 +58,9 @@ def insider(l_args, s_ticker): def news(l_args, s_ticker): parser = argparse.ArgumentParser( prog="news", - description="""Prints latest news about company, including title and web link. - [Source: Finviz]""", + description=""" + Prints latest news about company, including title and web link. [Source: Finviz] + """, ) parser.add_argument( @@ -99,13 +101,14 @@ def news(l_args, s_ticker): def analyst(l_args, s_ticker): parser = argparse.ArgumentParser( prog="analyst", - description="""Print analyst prices and ratings of the company. The following fields - are expected: date, analyst, category, price from, price to, and rating. - [Source: Finviz]""", + description=""" + Print analyst prices and ratings of the company. The following fields are expected: + date, analyst, category, price from, price to, and rating. [Source: Finviz] + """, ) try: - (ns_parser, l_unknown_args) = parser.parse_known_args(l_args) + (_, l_unknown_args) = parser.parse_known_args(l_args) if l_unknown_args: print(f"The following args couldn't be interpreted: {l_unknown_args}\n") diff --git a/gamestonk_terminal/due_diligence/market_watch_api.py b/gamestonk_terminal/due_diligence/market_watch_api.py index 38bb9fe1747..a9a9e5cdad0 100644 --- a/gamestonk_terminal/due_diligence/market_watch_api.py +++ b/gamestonk_terminal/due_diligence/market_watch_api.py @@ -3,16 +3,22 @@ import pandas as pd from bs4 import BeautifulSoup import requests import numpy as np -from gamestonk_terminal.helper_funcs import * +from gamestonk_terminal.helper_funcs import ( + check_positive, + get_user_agent, + clean_data_values_to_float, + int_or_round_float, +) # ---------------------------------------------------- SEC FILLINGS ---------------------------------------------------- def sec_fillings(l_args, s_ticker): parser = argparse.ArgumentParser( prog="sec", - description="""Prints SEC filings of the company. The following fields - are expected: Filing Date, Document Date, Type, Category, Amended, and Link. - [Source: Market Watch]""", + description=""" + Prints SEC filings of the company. The following fields are expected: Filing Date, + Document Date, Type, Category, Amended, and Link. [Source: Market Watch] + """, ) parser.add_argument( diff --git a/gamestonk_terminal/due_diligence/reddit_api.py b/gamestonk_terminal/due_diligence/reddit_api.py index c8ea55956f7..bf1f486ed09 100644 --- a/gamestonk_terminal/due_diligence/reddit_api.py +++ b/gamestonk_terminal/due_diligence/reddit_api.py @@ -1,22 +1,18 @@ import argparse -from prettytable import PrettyTable from datetime import datetime, timedelta -import pandas as pd +from prettytable import PrettyTable from psaw import PushshiftAPI import praw -from datetime import datetime -from pytz import timezone -from holidays import US as holidaysUS -from gamestonk_terminal.helper_funcs import * -import re -import finviz +from gamestonk_terminal.helper_funcs import check_positive from gamestonk_terminal import config_terminal as cfg # ------------------------------------------------------------------------------------------------------------------- def due_diligence(l_args, s_ticker): parser = argparse.ArgumentParser( prog="red", - description="""Print top stock's due diligence from other users. [Source: Reddit] """, + description=""" + Print top stock's due diligence from other users. [Source: Reddit] + """, ) parser.add_argument( @@ -43,8 +39,10 @@ def due_diligence(l_args, s_ticker): action="store_true", dest="b_all", default=False, - help="""search through all flairs (apart from Yolo and Meme), otherwise we focus on - specific flairs: DD, technical analysis, Catalyst, News, Advice, Chart """, + help=""" + search through all flairs (apart from Yolo and Meme), otherwise we focus on + specific flairs: DD, technical analysis, Catalyst, News, Advice, Chart + """, ) try: