mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-13 21:02:13 +00:00
Add research web pages menu
This commit is contained in:
127
res_menu.py
Normal file
127
res_menu.py
Normal file
@@ -0,0 +1,127 @@
|
||||
import config_bot as cfg
|
||||
import argparse
|
||||
import webbrowser
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------------------
|
||||
def print_research():
|
||||
""" Print help """
|
||||
|
||||
print("\nResearch Mode:")
|
||||
print(" help show this fundamental analysis menu again")
|
||||
print(" q quit this menu, and shows back to main menu")
|
||||
print(" quit quit to abandon program")
|
||||
print("")
|
||||
print(" macroaxis www.macroaxis.com")
|
||||
print(" yahoo www.finance.yahoo.com")
|
||||
print(" finviz www.finviz.com")
|
||||
print(" mw www.marketwatch.com")
|
||||
print(" fool www.fool.com")
|
||||
print(" bi www.markets.businessinsider.com")
|
||||
print(" fmp www.financialmodelingprep.com")
|
||||
print(" fidelity www.eresearch.fidelity.com")
|
||||
print("")
|
||||
return
|
||||
|
||||
|
||||
# ---------------------------------------------------- MENU ----------------------------------------------------
|
||||
def res_menu(s_ticker):
|
||||
|
||||
# Add list of arguments that the discovery parser accepts
|
||||
res_parser = argparse.ArgumentParser(prog='discovery', add_help=False)
|
||||
res_parser.add_argument('cmd', choices=['help', 'q', 'quit',
|
||||
'macroaxis', 'yahoo', 'finviz', 'mw', 'fool', 'bi', 'fmp', 'fidelity'])
|
||||
|
||||
print_research()
|
||||
|
||||
# Loop forever and ever
|
||||
while True:
|
||||
# Get input command from user
|
||||
as_input = input('> ')
|
||||
|
||||
# Parse fundamental analysis command of the list of possible commands
|
||||
try:
|
||||
(ns_known_args, l_args) = res_parser.parse_known_args(as_input.split())
|
||||
|
||||
except SystemExit:
|
||||
print("The command selected doesn't exist\n")
|
||||
continue
|
||||
|
||||
if ns_known_args.cmd == 'help':
|
||||
print_research()
|
||||
|
||||
elif ns_known_args.cmd == 'q':
|
||||
# Just leave the RES menu
|
||||
return False
|
||||
|
||||
elif ns_known_args.cmd == 'quit':
|
||||
# Abandon the program
|
||||
return True
|
||||
|
||||
elif ns_known_args.cmd == 'macroaxis':
|
||||
try:
|
||||
webbrowser.open(f"https://www.macroaxis.com/invest/market/{s_ticker}")
|
||||
print("")
|
||||
except SystemExit:
|
||||
print("")
|
||||
return
|
||||
|
||||
elif ns_known_args.cmd == 'yahoo':
|
||||
try:
|
||||
webbrowser.open(f"https://finance.yahoo.com/quote/{s_ticker}")
|
||||
print("")
|
||||
except SystemExit:
|
||||
print("")
|
||||
return
|
||||
|
||||
elif ns_known_args.cmd == 'finviz':
|
||||
try:
|
||||
webbrowser.open(f"https://finviz.com/quote.ashx?t={s_ticker}")
|
||||
print("")
|
||||
except SystemExit:
|
||||
print("")
|
||||
return
|
||||
|
||||
elif ns_known_args.cmd == 'mw':
|
||||
try:
|
||||
webbrowser.open(f"https://www.marketwatch.com/investing/stock/{s_ticker}")
|
||||
print("")
|
||||
except SystemExit:
|
||||
print("")
|
||||
return
|
||||
|
||||
elif ns_known_args.cmd == 'fool':
|
||||
try:
|
||||
webbrowser.open(f"https://www.fool.com/quote/{s_ticker}")
|
||||
print("")
|
||||
except SystemExit:
|
||||
print("")
|
||||
return
|
||||
|
||||
elif ns_known_args.cmd == 'bi':
|
||||
try:
|
||||
webbrowser.open(f"https://markets.businessinsider.com/stocks/{s_ticker}-stock/")
|
||||
print("")
|
||||
except SystemExit:
|
||||
print("")
|
||||
return
|
||||
|
||||
elif ns_known_args.cmd == 'fmp':
|
||||
try:
|
||||
webbrowser.open(f"https://financialmodelingprep.com/financial-summary/{s_ticker}")
|
||||
print("")
|
||||
except SystemExit:
|
||||
print("")
|
||||
return
|
||||
|
||||
elif ns_known_args.cmd == 'fidelity':
|
||||
try:
|
||||
webbrowser.open(f"https://eresearch.fidelity.com/eresearch/goto/evaluate/snapshot.jhtml?symbols={s_ticker}")
|
||||
print("")
|
||||
except SystemExit:
|
||||
print("")
|
||||
return
|
||||
|
||||
# ------------------------------------------------------------------------------------------------------------
|
||||
else:
|
||||
print("Command not recognized!")
|
||||
@@ -44,6 +44,7 @@ from fundamental_analysis import fa_menu as fam
|
||||
from technical_analysis import ta_menu as tam
|
||||
from due_diligence import dd_menu as ddm
|
||||
from discovery import disc_menu as dm
|
||||
import res_menu as rm
|
||||
|
||||
# delete this important when automatic loading tesla
|
||||
#i.e. when program is done
|
||||
@@ -197,6 +198,7 @@ def print_help(s_ticker, s_start, s_interval, b_is_market_open):
|
||||
if s_ticker:
|
||||
print("\nMenus:")
|
||||
#print(" sen sentiment of the market, \t from: reddit, stocktwits, twitter")
|
||||
print(" res research web page, \t e.g.: macroaxis, yahoo finance, fool")
|
||||
print(" fa fundamental analysis, \t e.g.: income, balance, cash, earnings")
|
||||
print(" ta technical analysis, \t e.g.: ema, macd, rsi, adx, bbands, obv")
|
||||
print("")
|
||||
@@ -240,7 +242,7 @@ def main():
|
||||
menu_parser = argparse.ArgumentParser(prog='stock_market_bot', add_help=False)
|
||||
menu_parser.add_argument('opt', choices=['help', 'quit', 'q',
|
||||
'clear', 'load', 'view',
|
||||
'disc', 'fa', 'ta', 'dd'])
|
||||
'disc', 'res', 'fa', 'ta', 'dd'])
|
||||
|
||||
|
||||
# Print first welcome message and help
|
||||
@@ -294,6 +296,16 @@ def main():
|
||||
else:
|
||||
print_help(s_ticker, s_start, s_interval, b_is_stock_market_open())
|
||||
|
||||
# RESEARCH MENU
|
||||
elif ns_known_args.opt == 'res':
|
||||
b_quit = rm.res_menu(s_ticker)
|
||||
|
||||
if b_quit:
|
||||
print("Hope you made money today. Good bye my lover, good bye my friend.\n")
|
||||
return
|
||||
else:
|
||||
print_help(s_ticker, s_start, s_interval, b_is_stock_market_open())
|
||||
|
||||
# FUNDAMENTAL ANALYSIS MENU
|
||||
elif ns_known_args.opt == 'fa':
|
||||
b_quit = fam.fa_menu(s_ticker, s_start, s_interval)
|
||||
|
||||
Reference in New Issue
Block a user