mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 21:12:16 +00:00
Add help flag to comparison analysis menu
This commit is contained in:
@@ -10,13 +10,16 @@ from gamestonk_terminal.comparison_analysis import yahoo_finance_api as yf_api
|
||||
def get_similar_companies(l_args, s_ticker):
|
||||
""" Get similar companies. [Source: Polygon API] """
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
prog="get",
|
||||
description="""Get similar companies to compare with.""",
|
||||
)
|
||||
|
||||
l_similar = []
|
||||
try:
|
||||
parse_known_args_and_warn(parser, l_args)
|
||||
ns_parser = parse_known_args_and_warn(parser, l_args)
|
||||
if not ns_parser:
|
||||
return
|
||||
|
||||
result = requests.get(
|
||||
f"https://api.polygon.io/v1/meta/symbols/{s_ticker}/company?&apiKey={cfg.API_POLYGON_KEY}"
|
||||
@@ -35,6 +38,7 @@ def get_similar_companies(l_args, s_ticker):
|
||||
def select_similar_companies(l_args):
|
||||
""" Select similar companies, e.g. NIO,XPEV,LI"""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
prog="select",
|
||||
description="""Select similar companies to compare with.""",
|
||||
)
|
||||
@@ -54,6 +58,9 @@ def select_similar_companies(l_args):
|
||||
l_args.insert(0, "-s")
|
||||
|
||||
ns_parser = parse_known_args_and_warn(parser, l_args)
|
||||
if not ns_parser:
|
||||
return
|
||||
|
||||
print("")
|
||||
return ns_parser.l_similar
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ def check_one_of_ohlca(type_candles: str) -> str:
|
||||
|
||||
def historical(l_args, df_stock, s_ticker, s_start, s_interval, similar):
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
prog="historical",
|
||||
description="""Historical price comparison between similar companies [Source: Yahoo Finance]
|
||||
""",
|
||||
@@ -70,6 +71,8 @@ def historical(l_args, df_stock, s_ticker, s_start, s_interval, similar):
|
||||
# Alpha Vantage only supports 5 calls per minute, we need another API to get intraday data
|
||||
else:
|
||||
ns_parser = parse_known_args_and_warn(parser, l_args)
|
||||
if not ns_parser:
|
||||
return
|
||||
|
||||
if ns_parser.l_similar:
|
||||
similar = ns_parser.l_similar
|
||||
@@ -112,6 +115,7 @@ def historical(l_args, df_stock, s_ticker, s_start, s_interval, similar):
|
||||
|
||||
def correlation(l_args, df_stock, s_ticker, s_start, s_interval, similar):
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
prog="corr",
|
||||
description=""" Correlation heatmap based on historical price comparison between similar
|
||||
companies. [Source: Yahoo Finance]
|
||||
@@ -149,6 +153,8 @@ def correlation(l_args, df_stock, s_ticker, s_start, s_interval, similar):
|
||||
# Alpha Vantage only supports 5 calls per minute, we need another API to get intraday data
|
||||
else:
|
||||
ns_parser = parse_known_args_and_warn(parser, l_args)
|
||||
if not ns_parser:
|
||||
return
|
||||
|
||||
if ns_parser.l_similar:
|
||||
similar = ns_parser.l_similar
|
||||
|
||||
Reference in New Issue
Block a user