- requires 'pip'
pip install pandas
pip install pandas-datareader
-m pip install matplotlib
-m pip install requests
pip install tqdm
This project combines stock analyst firms upgrade and downgrade data of the snp500 tickers, and compares the results with future stock price data. Its current executable, 'Loaded_Databases.ipynb, when ran with its instructions, can do analysis on the success rates of the analysts compared to what happened.
This program is scripted in Python, involves webscraping Yahoo Finance analyst lxml, creates Pandas Dataframes, and provides some visualizations using matplotlib
-
the database is already created within the folder databases, it isn't important to run this code. This is just a reference of methodology.
-
stock_upgradedowngradeHistory: Code used to scrape, clean, and combine data into relevant dataframes.
-
Webscraped Yahoo Finance stock analyst data using BeautifulSoup4 and JSON
-
Python Pandas to combine JSON objects into DataFrames
-
Joined Upgrade Downgrade data with stock ticker historical data
-
Combined grading terms into 5 different terms: Strong Buy, Buy, Hold, Sell, and Underperform
-
added 1 day before, 1 day after, 30 days after, 60 days after, and 90 days after dates, prices, and percent changed from Open
-
returned final dataframe with following columns
[['stockTicker',
'Date',
'Open',
'Close',
'Volume',
'firm',
'action',
'fromGrade',
'fromGrade_combined',
'toGrade',
'toGrade_combined',
'1_day_before_grade_Date',
'1_day_before_grade_Date_Price',
'percent1Before',
'1_day_from_grade_Date',
'1_day_from_grade_Date_Price',
'percent1After',
'30_days_from_grade_Date',
'30_days_from_grade_Date_Price',
'percent30',
'60_days_from_grade_Date',
'60_days_from_grade_Date_Price',
'percent60',
'90_days_from_grade_Date',
'90_days_from_grade_Date_Price',
'percent90']]
- This is the code to run for analysis
- Open with Jupyter Notebook
- Opens from the database folder, snp500merged and securities.csv (securities.csv retrieved from https://www.kaggle.com/dgawlik/nyse )
- run each cell