Skip to content

Many market analysts believe that predicting market’s stocks fluctuations is nearly impossible to achieve due to the number of variables involved, especially since many of these variables are based on irrational factors such as human sentiment. However, I developed a model that uses a combination of sentiment analysis, clustering and feed-forwar…

Notifications You must be signed in to change notification settings

BenChaliah/FundamentalAnalysis

Repository files navigation

Stock market forecasting : Fundamental analysis

Theoretical report
Experimental report

Preparing the financial data (news & market values)

from FinancialData import financial_data
iex = financial_data()
print(iex.get_trade_bars(['AAPL'], '1m')[:10])
print(iex.get_news(['AAPL', 'MSFT'])[['symbol','time','headline']][:10])
# list(iex.all_ticker()) : list off all valid securities' symbols
# This step could take a while, considering that this API provides 8750 security's related news
df = iex.get_news(list(iex.all_ticker()))
df.to_excel("assets/news.xlsx")
##### IOdy.py : ######
import pandas as pd
from datetime import datetime, timedelta
from pandas_datareader import data
import numpy as np

news = pd.read_excel('assets/news.xlsx', index_col=0)

#remove news that are published earlier than 30 days from today
absolute_thresh = pd.Timestamp(datetime.today().date()-timedelta(days=37))
news = pd.read_excel('assets/news.xlsx', index_col=0)
news = news.loc[news['time']>=absolute_thresh]
news[['symbol', 'time', 'headline', 'summary']].head(2)
symbol time headline summary
0 KAI 2019-04-04 16:25:54 12 Upcoming Dividend Increases I'm a huge fan of dividend growth stocks an...
1 ALTM 2019-04-12 21:27:00 FERC clears EPIC pipeline rates, three others ... The 550K bbl/day EPIC pipeline wins appr...
# This function uses Yahoo Finance to market data
def get_market(security, start_date, end_date):
	end_date_str = end_date.strftime("%Y-%m-%d")
	start_date_str = start_date.strftime("%Y-%m-%d")
	asset_ = data.DataReader(security,  start=start_date_str, end=end_date_str, data_source='yahoo')
	return asset_

get_market('AAPL', intervals_[0][0], intervals_[0][1])
High Low Open Close Volume Adj Close
Date
2019-03-21 196.330002 189.809998 190.020004 195.089996 51034200 195.089996
2019-03-22 197.690002 190.779999 195.339996 191.050003 42407700 191.050003

About

Many market analysts believe that predicting market’s stocks fluctuations is nearly impossible to achieve due to the number of variables involved, especially since many of these variables are based on irrational factors such as human sentiment. However, I developed a model that uses a combination of sentiment analysis, clustering and feed-forwar…

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published