From e0506f5819b15609ba7d93f3292c16b323fa36c8 Mon Sep 17 00:00:00 2001 From: didier Date: Fri, 1 Jan 2021 12:13:30 +0000 Subject: [PATCH] Add info regarding Fundamental Analysis key metrics --- stock_market_cli.py | 17 ++++++++++++++--- stock_market_fundamental_analysis.py | 27 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/stock_market_cli.py b/stock_market_cli.py index 7e1ed07d904..ad8d373ea0a 100644 --- a/stock_market_cli.py +++ b/stock_market_cli.py @@ -10,9 +10,15 @@ using an API request. Finviz for data - Parse overview stock with pip request Multiple TA with kind stock + Do my own personal Fundamental Analysis Dataframe + Do option to explain important key metrics + + Do own personal Technical Analysis with multiple indicators perhaps? + + Split Menu into fa, ta and pred. Fundamental Analysis, Technical Analysis and Prediction, respectively. + """ from alpha_vantage.timeseries import TimeSeries @@ -54,6 +60,7 @@ def print_help(s_ticker, s_start, s_interval, b_is_market_open): if s_ticker: print("\nFundamental Analysis:") # https://github.com/JerBouma/FundamentalAnalysis + print(" info provides information on main key metrics of company") print("details:") print(" profile profile of the company [FMP]") print(" rating rating of the company from strong sell to strong buy [FMP]") @@ -118,7 +125,7 @@ def main(): s_interval = "1440min" # Set stock by default to speed up testing - s_ticker = "TSLA" + s_ticker = "NIO" s_start = datetime.strptime("2020-06-04", "%Y-%m-%d") ts = TimeSeries(key=cfg.API_KEY_ALPHAVANTAGE, output_format='pandas') df_stock, d_stock_metadata = ts.get_daily_adjusted(symbol=s_ticker, outputsize='full') @@ -132,7 +139,7 @@ def main(): 'sma', 'ema', 'macd', 'vwap', 'stoch', 'rsi', 'adx', 'quote', 'cci', 'aroon', 'bbands', 'ad', 'obv', 'rating', 'profile', 'income', 'balance', 'cash', 'metrics', 'ratios', 'growth', - 'enterprise', 'dcf', 'overview', 'earnings']) + 'enterprise', 'dcf', 'overview', 'earnings', 'info']) # Print first welcome message and help print("\nWelcome to Didier's Stock Market Bot\n") @@ -195,6 +202,10 @@ def main(): # -------------------------------------------------------------------------------------------------------------- # -------------------------------------------------- DETAILS -------------------------------------------------- + elif ns_known_args.cmd == 'info': + smfa.info(l_args, s_ticker) + continue + elif ns_known_args.cmd == 'profile': smfa.profile(l_args, s_ticker) continue diff --git a/stock_market_fundamental_analysis.py b/stock_market_fundamental_analysis.py index 076c50f893c..0a2e870c930 100644 --- a/stock_market_fundamental_analysis.py +++ b/stock_market_fundamental_analysis.py @@ -11,6 +11,33 @@ import requests from pandas.io.json import json_normalize +# ---------------------------------------------------- INFO ---------------------------------------------------- +def info(l_args, s_ticker): + parser = argparse.ArgumentParser(prog='info', + description="""Provides information about main key metrics. Namely: EBITDA, + EPS, P/E, PEG, FCF, P/B, ROE, DPR, P/S, Dividend Yield Ratio, D/E, and Beta.""") + + try: + (ns_parser, l_unknown_args) = parser.parse_known_args(l_args) + except SystemExit: + print("") + return + + if l_unknown_args: + print(f"The following args couldn't be interpreted: {l_unknown_args}") + + try: + filepath = 'fundamental_analysis_indicators_explained.txt' + with open(filepath) as fp: + line = fp.readline() + while line: + print("{}".format(line.strip())) + line = fp.readline() + print("") + except: + print("ERROR!\n") + + # ---------------------------------------------------- PROFILE ---------------------------------------------------- def profile(l_args, s_ticker): parser = argparse.ArgumentParser(prog='profile',