Beating the market -- forecasting the S&P 500 Index

Slides:



Advertisements
Similar presentations
Shino Takayama The University of Sydney Faculty of Business and Economics Ch 12. Market Efficiency and Behavioural Finance.
Advertisements

Efficient Market Hypothesis Reference: RWJ Chp 13
Chapter 3 Market Efficiency
Efficient Market Hypothesis (EMH). Premises of An Efficient Market -A large number of competing profit-maximizing participants analyze and value securities,
Efficient Market Hypothesis
McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc., All Rights Reserved. Efficient Market Hypothesis 1.
FINANCE IN A CANADIAN SETTING Sixth Canadian Edition Lusztig, Cleary, Schwab.
The Theory of Capital Markets
The McGraw-Hill Companies, Inc., 2000
Market Efficiency Chapter 12. Do security prices reflect information ? Why look at market efficiency - Implications for business and corporate finance.
Behavioral Finance EMH and Critics Jan 15-20, 2015 Behavioral Finance Economics 437.
Corporate Financing and the Six Lessons of Market Efficiency
Efficient Capital Markets Two Views on Capital Market Efficiency: “... in price movements... the sum of every scrap of knowledge available to Wall Street.
1 Technical Analysis CHAPTER 19. Technical Analysis Technical analysis is a security analysis technique that claims the ability to forecast the future.
7- 1 McGraw Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc. All rights reserved Fundamentals of Corporate Finance Sixth Edition Richard.
© 2008 Pearson Education Canada7.1 Chapter 7 The Stock Market, the Theory of Rational Expectations, and the Efficient Markets Hypothesis.
FIN 614: Financial Management Larry Schrenk, Instructor.
Article 2 The theory of stock market efficiency Dr. Yang April 15, 2015 Group 2 Greg Werthman Kapil Jain Aaron Cyr Richard Oluoha Jen-Chiang La.
McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc., All Rights Reserved. Efficient Markets Hypothesis 1.
1 Three Approaches to Security Selection Technical Analysis Fundamental Analysis –Economic Analysis –Industry Analysis –Company Analysis Efficient Markets.
Efficient Market Hypothesis EMH Presented by Inderpal Singh.
FIN 352 – Professor Dow.  Fama: Test the efficient market hypothesis using different information sets.  Three categories:  Weak  Semi-Strong  Strong.
EMH- 0 Efficient Market Hypothesis Eugene Fama, 1964 A market where there are huge number of rational, profit-maximizers actively competing, with each.
Capital Markets Theory Lecture 5 International Finance.
The Theory of Capital Markets Rational Expectations and Efficient Markets.
Chapter 8 The Efficient Market Hypothesis. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc., All Rights Reserved. Efficient Market Hypothesis.
McGraw-Hill/Irwin © 2007 The McGraw-Hill Companies, Inc., All Rights Reserved. Efficient Markets & The Behavioral Critique CHAPTE R 8.
7- 1 McGraw Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc. All rights reserved Fundamentals of Corporate Finance Sixth Edition Richard.
Machine Learning in Stock Price Trend Forecasting BY PRADEEP KUMAR REDDY MUSKU.
The Market Hypothesis The Efficient Market Hypothesis.
McGraw-Hill/Irwin Copyright © 2005 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 12 Market Efficiency and Behavioral Finance.
McGraw-Hill/Irwin Copyright © 2001 by The McGraw-Hill Companies, Inc. All rights reserved Market Efficiency Chapter 11.
 The McGraw-Hill Companies, Inc., 1999 INVESTMENTS Fourth Edition Bodie Kane Marcus Irwin/McGraw-Hill 12-1 Market Efficiency Chapter 12.
McGraw-Hill/Irwin © 2007 The McGraw-Hill Companies, Inc., All Rights Reserved. Efficient Markets & The Behavioral Critique CHAPTER 8.
Chapter 10 Market Efficiency.
Essentials of Investments © 2001 The McGraw-Hill Companies, Inc. All rights reserved. Fourth Edition Irwin / McGraw-Hill Bodie Kane Marcus 1 Chapter 9.
Efficient Market Theory. Efficient Markets In an efficient stock market, the price for any given stock effectively represents the expected net present.
Are Markets Efficient? by Matt Ingram Invest Ed® All Rights Reserved Oklahoma Securities Commission July 2016.
INTRODUCTION TO INVESTING
Data Mining, Machine Learning, Data Analysis, etc. scikit-learn
Corporate Financing and Market Efficiency
Chapter 9 Market Efficiency.
MARKET EFFICIENCY The concept of Market Efficiency:
Market Efficiency Chapter 12
Efficient Market Hypothesis
Randomness in Neural Networks
Lecture 8: Corporate Financing Decisions and Efficient Markets.
Efficient Markets and Behavioral Finance
Chapter 7 The Stock Market, the Theory of Rational Expectations, and the Efficient Market Hypothesis.
AFTER MID-TERM Miss: Eman Elfar
CHAPTER NINE MARKET EFFICIENCY © 2001 South-Western College Publishing.
Chapter 12 Efficient Markets: Theory And Evidence
Intro to NLP and Deep Learning
The McGraw-Hill Companies, Inc., 2000
Investments and Portfolio Management
Topic #4 Financial Instruments in the Market: II Stocks
Efficient Markets and Behavioral Finance
Understanding LSTM Networks
Market Efficiency and Behavioral Finance
Other Classification Models: Recurrent Neural Network (RNN)
Data Mining, Machine Learning, Data Analysis, etc. scikit-learn
Data Mining, Machine Learning, Data Analysis, etc. scikit-learn
How Efficient Is the Market?
LSTM: Long Short Term Memory
Portfolio management and efficient market hypothesis
Lectures 11 and 12 The Stock Market, the Theory of Rational Expectations, and the Efficient Market Hypothesis.
LHC beam mode classification
Andrew Karl, Ph.D. James Wisnowski, Ph.D. Lambros Petropoulos
Effect of Algorithmic Variables in LSTM's Prediction of Constituent Direction of the S&P 500: as Applied to EMH.
Presentation transcript:

Beating the market -- forecasting the S&P 500 Index Frank Saldivar Mauricio Ortiz

“Life can only be understood backwards; but it must be lived forwards “Life can only be understood backwards; but it must be lived forwards.” - Søren Kierkegaard

Background Around 1970, an economist Eugene Fama launched the Efficient Market Hypothesis Weak Form: past information is priced into securities Semi-Strong Form: stock price is instantly adjusted in response to new information Strong Form: all information, public and private is reflected in a stock’s price Random Walk Theory The stock market behaves randomly

Current non-ML Methods Fundamental Analysis Study surrounding economy, industry conditions, company data Find intrinsic value of stock - see if undervalued or overvalued If overvalued, sell If undervalued, buy Technical Analysis Stock price & volume are only inputs Assume all known fundamentals are baked into price Identify patterns and trends to predict

Goal Are we able to predict future stock prices given past prices and patterns? Which approaches of machine learning work best? Compare and contrast two models Linear Regression Long Short-Term Memory - Recurrent Neural Network

Data SPDR S&P 500 ETF 23 years of price data Fund based on the S&P 500 index, the 500 largest US publicly traded companies such as Exxon Mobil, Apple, Coca-Cola, etc 23 years of price data 3/15/1996 - 3/14/2019 5789 entries total 80/20 split for training/testing 4631 training entries 1158 testing entries

Tools & Libraries used NumPy Pandas DataFrames Scikit-Learn (sklearn) Keras Matplotlib Yahoo Finance

Linear Regression Simple regression from sklearn Very straightforward, load in data, call sklearn’s LinearRegression and fit

Linear Regression Results

Linear Regression Results As expected, linear regression performed poorly Having a complex problem like stock price prediction may be beyond the scope of simple linear regression Can we do better??

RNN Information persists throughout network Long Term Dependencies “the clouds are in the sky” “I grew up in France… I speak fluent French.”

LSTM Variation of RNN Multi-layer repeating module Steps: What to forget What to store What values to update What new values to store Update state Decide Output Multiple variations exist

LSTM Load and Scale Data Build LSTM Sequential Dense LSTM Dropout

LSTM Training Data (1996 - 2016) Test Data (2016 - 2019) Normal and Reversed Data 1, 5, 25, 40, 100, 1000 epochs

LSTM Results - 1 epoch Normal sorted data Reverse sorted data

LSTM Results - 5 epochs Normal sorted data Reverse sorted data

LSTM Results - 25 epochs Normal sorted data Reverse sorted data

LSTM Results - 40 epochs Reverse sorted data Normal sorted data

LSTM Results - 100 epochs Normal sorted data Reverse sorted data

Results - Normal Sorted Data 1 epoch 10 epochs 10 epochs 5 epochs 40 epochs 1000 epochs

Results - Reverse Sorted Data 1 epoch 10 epochs 100 epochs 5 epochs 1000 epochs 40 epochs

Discussion More epochs != better results Why does normal sorted data tend towards worse predictions over more epochs? Why does reverse sorted data lead to diminishing returns in accuracy? We posit that there exists a sweet spot in iterations that results in highest accuracy/epoch

Future Improvements & Conclusion Focus on singular stock, however may result in higher volatility Historical price is not the only factor in future price. Inspired by fundamental analysis, solve for significant factors Account for: Investor sentiment -- via Twitter or news Company qualitative data Miscellaneous factors

References A simple deep learning model for stock price prediction using TensorFlow https://medium.com/mlreview/a-simple-deep-learning-model-for-stock-price-prediction-using-tensorflow-30505541d877 Predicting the Stock Market Using Machine Learning and Deep Learning https://www.analyticsvidhya.com/blog/2018/10/predicting-stock-price-machine-learningnd-deep-learning-techniques-python/ Using a Keras Long Short-Term Memory (LSTM) Model to Predict Stock Prices https://www.kdnuggets.com/2018/11/keras-long-short-term-memory-lstm-model-predict-stock-prices.html Understanding LSTM Networks https://colah.github.io/posts/2015-08-Understanding-LSTMs/