Improve disocvery folder comments

This commit is contained in:
didier
2021-02-20 08:57:18 +00:00
parent 109abb9877
commit f5e688bc5e
10 changed files with 63 additions and 50 deletions

View File

@@ -6,7 +6,9 @@ import matplotlib.pyplot as plt
# ---------------------------------------------------- SECTORS ----------------------------------------------------
def sectors(l_args):
parser = argparse.ArgumentParser(prog='sectors', description='Plot sectors performance')
parser = argparse.ArgumentParser(prog='sectors',
description='''Real-time and historical sector performances calculated from S&P500 incumbents.
Pops plot in terminal. [Source: Alpha Vantage]''')
try:
(ns_parser, l_unknown_args) = parser.parse_known_args(l_args)

View File

@@ -23,13 +23,13 @@ def print_discovery():
print(" map S&P500 index stocks map [Finviz]")
print(" sectors show sectors performance [Alpha Vantage]")
print(" gainers show latest top gainers [Yahoo Finance]")
print(" orders Orders by Fidelity Customers [Fidelity]")
print(" earnings next earnings release dates [Seeking Alpha]")
print(" orders orders by Fidelity Customers [Fidelity]")
print(" up_earnings upcoming earnings release dates [Seeking Alpha]")
print(" high_short show top high short interest stocks of over 20% ratio [www.highshortinterest.com]")
print(" low_float show low float stocks under 10M shares float [www.lowfloat.com]")
print(" sw Simply Wall St. research data [Simply Wall St.]")
print(" spachero Best website for SPACs research [SpacHero]")
print(" uwhales Good website for SPACs research [UnusualWhales]")
print(" simply_wallst Simply Wall St. research data [Simply Wall St.]")
print(" spachero great website for SPACs research [SpacHero]")
print(" uwhales good website for SPACs research [UnusualWhales]")
print("")
return
@@ -41,7 +41,8 @@ def disc_menu():
disc_parser = argparse.ArgumentParser(prog='discovery', add_help=False)
disc_parser.add_argument('cmd', choices=['help', 'q', 'quit',
'map', 'sectors', 'gainers', 'spacs', 'orders', 'spachero',
'high_short', 'low_float', 'earnings', 'sw', 'uwhales'])
'high_short', 'low_float', 'up_earnings', 'simply_wallst',
'uwhales'])
print_discovery()
@@ -94,11 +95,11 @@ def disc_menu():
fidelity_api.orders(l_args)
# ------------------------------------------------ SIMPLY WALL ST ------------------------------------------------
elif ns_known_args.cmd == 'sw':
elif ns_known_args.cmd == 'simply_wallst':
simply_wallst_api.simply_wallst(l_args)
# ------------------------------------------------ SEEKING ALPHA ------------------------------------------------
elif ns_known_args.cmd == 'earnings':
elif ns_known_args.cmd == 'up_earnings':
seeking_alpha_api.earnings_release_dates(l_args)
# ------------------------------------------------ SHORT_INTEREST ------------------------------------------------

View File

@@ -7,9 +7,14 @@ from helper_funcs import *
# ---------------------------------------------------- ORDERS ----------------------------------------------------
def orders(l_args):
parser = argparse.ArgumentParser(prog='orders', description='''Orders by Fidelity customers''')
parser = argparse.ArgumentParser(prog='orders',
description='''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]''')
parser.add_argument('-n', "--num", action="store", dest="n_num", type=check_positive, default=10, help='Top orders')
parser.add_argument('-n', "--num", action="store", dest="n_num", type=check_positive, default=10,
help='Number of top ordered stocks to be printed.')
try:
(ns_parser, l_unknown_args) = parser.parse_known_args(l_args)

View File

@@ -3,12 +3,16 @@ import webbrowser
# ---------------------------------------------------- MAP_SP500 ----------------------------------------------------
def map_sp500(l_args):
parser = argparse.ArgumentParser(prog='map', description='''Performance index stocks map categorized by sectors and industries.
Size represents market cap. Default: 1 day S&P500''')
parser = argparse.ArgumentParser(prog='map',
description='''Performance index stocks map categorized by sectors and industries.
Size represents market cap. Opens web-browser. [Source: Finviz]''')
parser.add_argument('-p', "--period", action="store", dest="s_period", type=str, default="1d", choices=['1d', '1w', '1m', '3m', '6m', '1y'], help="Performance period")
parser.add_argument('-t', "--type", action="store", dest="s_type", type=str, default="sp500", choices=['sp500', 'world', 'full', 'etf'], help="Map filter")
parser.add_argument('-p', "--period", action="store", dest="s_period", type=str, default="1d",
choices=['1d', '1w', '1m', '3m', '6m', '1y'], help="Performance period.")
parser.add_argument('-t', "--type", action="store", dest="s_type", type=str, default="sp500",
choices=['sp500', 'world', 'full', 'etf'], help="Map filter type.")
# Conversion from period and type, to fit url requirements
d_period = {'1d':'', '1w':'w1', '1m':'w4', '3m':'w13', '6m':'w26', '1y':'w52'}
d_type = {'sp500':'sec', 'world':'geo', 'full':'sec_all', 'etf':'etf'}

View File

@@ -7,11 +7,13 @@ from helper_funcs import *
# ------------------------------------------------ EARNINGS_RELEASE_DATES -------------------------------------------------
def earnings_release_dates(l_args):
parser = argparse.ArgumentParser(prog='earnings_release_dates',
description='''Next earnings release dates [Seeking Alpha]''')
parser = argparse.ArgumentParser(prog='up_earnings',
description='''Upcoming earnings release dates. [Source: Seeking Alpha]''')
parser.add_argument('-p', "--pages", action="store", dest="n_pages", type=check_positive, default=10, help='Number of pages to read earnings from')
parser.add_argument('-n', "--num", action="store", dest="n_num", type=check_positive, default=3, help='Number of next earnings release dates to show')
parser.add_argument('-p', "--pages", action="store", dest="n_pages", type=check_positive, default=10,
help='Number of pages to read upcoming earnings from in Seeking Alpha website.')
parser.add_argument('-n', "--num", action="store", dest="n_num", type=check_positive, default=3,
help='Number of upcoming earnings release dates to print')
try:
(ns_parser, l_unknown_args) = parser.parse_known_args(l_args)
@@ -21,7 +23,10 @@ def earnings_release_dates(l_args):
l_earnings = list()
for idx in range(0, ns_parser.n_pages):
url_next_earnings = f"https://seekingalpha.com/earnings/earnings-calendar/{idx+1}"
if idx == 0:
url_next_earnings = f"https://seekingalpha.com/earnings/earnings-calendar"
else:
url_next_earnings = f"https://seekingalpha.com/earnings/earnings-calendar/{idx+1}"
text_soup_earnings = BeautifulSoup(requests.get(url_next_earnings).text, "lxml")
for bs_stock in text_soup_earnings.findAll('tr', {'data-exchange': 'NASDAQ'}):

View File

@@ -10,17 +10,15 @@ from helper_funcs import *
# ------------------------------------------------ HIGH_SHORT_INTEREST -------------------------------------------------
def high_short_interest(l_args):
parser = argparse.ArgumentParser(prog='high_short',
description='''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). Stock traders will often flock to
such stocks for no reason other than the fact that they have a high short interest and
the price can potentially move up very quickly as traders with open short positions move
to cover.''')
description='''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.
[Source: www.highshortinterest.com]''')
parser.add_argument('-n', "--num", action="store", dest="n_num", type=check_positive, default=10, help='Number of top stocks')
parser.add_argument('-n', "--num", action="store", dest="n_num", type=check_positive, default=10,
help='Number of top stocks to print.')
try:
(ns_parser, l_unknown_args) = parser.parse_known_args(l_args)
@@ -62,17 +60,14 @@ def high_short_interest(l_args):
# ---------------------------------------------------- LOW_FLOAT -----------------------------------------------------
def low_float(l_args):
parser = argparse.ArgumentParser(prog='low_float',
description='''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. You can view the data for
all exchanges together or only view exchanges of interest by clicking on the appropriate tab.
Low float stocks are often very volatile and are well known for making explosive upside moves.
Stock traders will often flock to such stocks for no reason other than the fact that they
have a low float and the price can potentially move up very quickly.''')
description='''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]''')
parser.add_argument('-n', "--num", action="store", dest="n_num", type=check_positive, default=10, help='Number of top stocks')
parser.add_argument('-n', "--num", action="store", dest="n_num", type=check_positive, default=10, help='Number of top stocks to print.')
try:
(ns_parser, l_unknown_args) = parser.parse_known_args(l_args)

View File

@@ -3,13 +3,12 @@ import webbrowser
# ---------------------------------------------------- Simply WallSt ----------------------------------------------------
def simply_wallst(l_args):
parser = argparse.ArgumentParser(prog='simply_wallst', description='''Simply Wall Street Research. The following industries
are acceptable: any, autombiles, 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, and utilities. ''')
parser = argparse.ArgumentParser(prog='simply_wallst',
description='''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.]''')
parser.add_argument('-i', "--industry", action="store", dest="s_industry", type=str, default="any", help="Industry type",
parser.add_argument('-i', "--industry", action="store", dest="s_industry", type=str, default="any", help="Industry of interest.",
choices=['any', 'automobiles', 'banks', 'capital-goods', 'commercial-services', 'consumer-durables',
'consumer-services', 'diversified-financials', 'energy', 'consumer-retailing',
'food-beverage-tobacco', 'healthcare', 'household', 'insurance', 'materials',

View File

@@ -3,7 +3,8 @@ import webbrowser
# ---------------------------------------------------- SPACHERO ----------------------------------------------------
def spachero(l_args):
parser = argparse.ArgumentParser(prog='spachero', description='''Great website for SPACs research''')
parser = argparse.ArgumentParser(prog='spachero',
description='''Great website for SPACs research. [Source: www.spachero.com]''')
try:
(ns_parser, l_unknown_args) = parser.parse_known_args(l_args)

View File

@@ -3,7 +3,8 @@ import webbrowser
# ---------------------------------------------------- UNUSUAL WHALES ----------------------------------------------------
def unusual_whales(l_args):
parser = argparse.ArgumentParser(prog='unusual_whales', description='''Good website for SPACs research''')
parser = argparse.ArgumentParser(prog='uwhales',
description='''Good website for SPACs research. [Source: www.unusualwhales.com]''')
try:
(ns_parser, l_unknown_args) = parser.parse_known_args(l_args)

View File

@@ -9,9 +9,9 @@ import pandas as pd
# ---------------------------------------------------- GAINERS ----------------------------------------------------
def gainers(l_args):
parser = argparse.ArgumentParser(prog='gainers',
description='Show top ticker gainers from Yahoo Finance')
description='Print up to 25 top ticker gainers in terminal. [Source: Yahoo Finance]')
parser.add_argument('-n', "--num", action="store", dest="n_gainers", type=int, default=5, choices=range(1, 25),
help='Number of the top gainers stocks to retrieve (default 5)')
help='Number of the top gainers stocks to retrieve.')
try:
(ns_parser, l_unknown_args) = parser.parse_known_args(l_args)