SlideShare a Scribd company logo
1 of 13
Modeling the Stock Market:
Common pitfalls… and how to avoid them!
Jess Stauth
Portfolio Management and Research
Jess@quantopian.com / @jstauth
Disclaimer
Quantopian provides this presentation to help people write trading
algorithms - it is not intended to provide investment advice. More
specifically, the material is provided for informational purposes only
and does not constitute an offer to sell, a solicitation to buy, or a
recommendation or endorsement for any security or strategy, nor does
it constitute an offer to provide investment advisory or other services
by Quantopian. In addition, the content neither constitutes investment
advice nor offers any opinion with respect to the suitability of any
security or any specific investment.
Motivation
Building a beautiful backtest is easy!
But…
Don’t expect anyone to pay you for it!
Building a model that predicts the future is HARD!
But…
Many people will fight to pay you a lot for doing that!
Ok, so it’s hard. I love hard work!
What’s the catch?
• It can be hard to know
when you have what you
want – aka “future
predictor”!
• We “simulate” the future
(usually using the past!) to
validate our model
• But what if our simulation
doesn’t match reality?
• Or our data was flawed?
• Or we just got lucky?
• Or…
Idea
Data
Research/
Build
model
Simulate
Trade
$$$
Common pitfalls that turn into
1. Overfitting
2. Overtrading
3. Non-stationary processes / regime changes
4. Lookahead aka “time travel illusion”
5. Model complexity
xkcd.com/2048/
Let’s talk about
overfitting
1. Overfitting
Real world example: The incredible shrinking portfolio
Example from A Quantopian author / model
developer in diligence.
A robust ‘information rich’ signal should show
stable or increasingly good performance (Sharpe
ratio) as you increase the number of assets
included.
Fundamental law of active management*:
IR = IC * sqrt(N)
Finding that your signal is degraded by expanding
the number of assets scored is a red flag that you
may have identified an unstable, noisy, or
spurious effect
How to avoid: Take care not to ‘over optimize’
your model on a small number of data points (in
our use case those are assets/ stock tickers)
*Grinold and Kahn. Active Portfolio Management – pdf online
This phenomenon of overly concentrated portfolios turned out to be
prevalent in the submissions to Quantopian’s daily contest.
In a ‘tearsheet feedback’ thread
and webinar we highlighted this
pitfall.
We ran a second feedback session
a few weeks later and…
2. Overtrading – three real examples
Algo A Algo B Algo C
“low” costs
“high” costs
Trading algorithms developed with the assumption of “low” (or no) cost of trading in the markets often show
unrealistically good returns.
How to avoid: Using conservative cost estimates, and looking at the sensitivity of your stock market model to
the underlying assumption of what your costs will be can be the difference between profits and losses in the
real world!
3. Regime Shift/Non-stationarity
• Many common time-series techniques assume data are stationary (constant mean and variance).
• Imagine doing all your research on data from 2016/17 and evaluating a model that makes money
shorting volatility…
• How to avoid: Know that markets are always changing and make sure to backtest over long
enough time ranges to see regime changes that might impact your model.
Vol Regimes – Quantopian Blog
4. Time travel illusion: What did you know and
when did you know it?
• Classic date alignment fail examples:
• Drop the timestamp from close prices and build a daily technical factor...
You’ll prove that knowing the 4pm price at 9am would be super valuable!
• Modeling earnings surprises and assuming your model knows actual reported
earnings on quarter end dates, when IRL you don’t get them for 45+ DAYS
after…
• How to avoid: Same principle as with modeling market impact, be
conservative with your assumptions about data timeliness and check
your strategy’s robustness to lagged data over a range of lags.
5. Model complexity
https://mirams.wordpress.com/2015/10/20/model-complexity/
Resources:
• https://blog.quantopian.com/9-mistakes-quants-make-that-cause-
backtests-to-lie-by-tucker-balch-ph-d/
• ^Tucker Balch recorded talk QuantCon 2015
• Lots of other great stuff on Quantopian’s Youtube Channel
• Quantopian Lectures
Thank you! Questions?
Do you have a unique idea and think you’ve avoided these pitfalls?
Enter the Quantopian Contest and find out if you’re smarter than the average Quantopian user!
www.quantopian.com/contest
Jess@quantopian.com / @jstauth

More Related Content

What's hot

The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...
The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...
The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...
Quantopian
 
"Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an...
"Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an..."Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an...
"Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an...
Quantopian
 

What's hot (20)

The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...
The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...
The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...
 
"A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris..."A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris...
 
Being open (source) in the traditionally secretive field of quant finance.
Being open (source) in the traditionally secretive field of quant finance.Being open (source) in the traditionally secretive field of quant finance.
Being open (source) in the traditionally secretive field of quant finance.
 
Quantopian is Launching a Crowd-sourced Hedge Fund
Quantopian is Launching a Crowd-sourced Hedge FundQuantopian is Launching a Crowd-sourced Hedge Fund
Quantopian is Launching a Crowd-sourced Hedge Fund
 
Tearsheet feedback webinar 10.10.18
Tearsheet feedback webinar 10.10.18Tearsheet feedback webinar 10.10.18
Tearsheet feedback webinar 10.10.18
 
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
 
"A Framework-Based Approach to Building Quantitative Trading Systems" by Dr. ...
"A Framework-Based Approach to Building Quantitative Trading Systems" by Dr. ..."A Framework-Based Approach to Building Quantitative Trading Systems" by Dr. ...
"A Framework-Based Approach to Building Quantitative Trading Systems" by Dr. ...
 
"Quantum Hierarchical Risk Parity - A Quantum-Inspired Approach to Portfolio ...
"Quantum Hierarchical Risk Parity - A Quantum-Inspired Approach to Portfolio ..."Quantum Hierarchical Risk Parity - A Quantum-Inspired Approach to Portfolio ...
"Quantum Hierarchical Risk Parity - A Quantum-Inspired Approach to Portfolio ...
 
Case Studies in Creating Quant Models from Large Scale Unstructured Text by S...
Case Studies in Creating Quant Models from Large Scale Unstructured Text by S...Case Studies in Creating Quant Models from Large Scale Unstructured Text by S...
Case Studies in Creating Quant Models from Large Scale Unstructured Text by S...
 
"Trading Strategies That Are Designed Not Fitted" by Robert Carver, Independe...
"Trading Strategies That Are Designed Not Fitted" by Robert Carver, Independe..."Trading Strategies That Are Designed Not Fitted" by Robert Carver, Independe...
"Trading Strategies That Are Designed Not Fitted" by Robert Carver, Independe...
 
"Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an...
"Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an..."Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an...
"Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an...
 
Algorithmic Trading Latest Trends & Developments Lecture By Dr. Lipa Roitman
Algorithmic Trading Latest Trends & Developments Lecture By Dr. Lipa RoitmanAlgorithmic Trading Latest Trends & Developments Lecture By Dr. Lipa Roitman
Algorithmic Trading Latest Trends & Developments Lecture By Dr. Lipa Roitman
 
"From Trading Strategy to Becoming an Industry Professional – How to Break in...
"From Trading Strategy to Becoming an Industry Professional – How to Break in..."From Trading Strategy to Becoming an Industry Professional – How to Break in...
"From Trading Strategy to Becoming an Industry Professional – How to Break in...
 
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas..."Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
 
Crowdsource Earnings Predictions and the Quantopian Research Platform
Crowdsource Earnings Predictions and the Quantopian Research PlatformCrowdsource Earnings Predictions and the Quantopian Research Platform
Crowdsource Earnings Predictions and the Quantopian Research Platform
 
"Enhancing Statistical Significance of Backtests" by Dr. Ernest Chan, Managin...
"Enhancing Statistical Significance of Backtests" by Dr. Ernest Chan, Managin..."Enhancing Statistical Significance of Backtests" by Dr. Ernest Chan, Managin...
"Enhancing Statistical Significance of Backtests" by Dr. Ernest Chan, Managin...
 
Futures Trading Strategies on SGX - India chapter in AFACT in Singapore
Futures Trading Strategies on SGX - India chapter in AFACT in SingaporeFutures Trading Strategies on SGX - India chapter in AFACT in Singapore
Futures Trading Strategies on SGX - India chapter in AFACT in Singapore
 
The Genesis of an Order Type by Dan Aisen, Co-founder and Quantitative Develo...
The Genesis of an Order Type by Dan Aisen, Co-founder and Quantitative Develo...The Genesis of an Order Type by Dan Aisen, Co-founder and Quantitative Develo...
The Genesis of an Order Type by Dan Aisen, Co-founder and Quantitative Develo...
 
Algorithmic Finance Meetup: Starmine Short Interest Talk
Algorithmic Finance Meetup: Starmine Short Interest Talk Algorithmic Finance Meetup: Starmine Short Interest Talk
Algorithmic Finance Meetup: Starmine Short Interest Talk
 
Quantopian: Crowd-sourced Systematic Alpha
Quantopian: Crowd-sourced Systematic AlphaQuantopian: Crowd-sourced Systematic Alpha
Quantopian: Crowd-sourced Systematic Alpha
 

Similar to Modeling the Stock Market: Common pitfalls and how to avoid them!

Stochastic Modeling - Financial Reporting
Stochastic Modeling - Financial ReportingStochastic Modeling - Financial Reporting
Stochastic Modeling - Financial Reporting
Ron Harasym
 

Similar to Modeling the Stock Market: Common pitfalls and how to avoid them! (20)

Startup financial modeling class - general assembly sf -- septemer 27
Startup financial modeling class  - general assembly sf -- septemer 27Startup financial modeling class  - general assembly sf -- septemer 27
Startup financial modeling class - general assembly sf -- septemer 27
 
Machine learning for factor investing
Machine learning for factor investingMachine learning for factor investing
Machine learning for factor investing
 
Stop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo SimulationStop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo Simulation
 
Injecting Certainty Into An Uncertain Process
Injecting Certainty Into An Uncertain ProcessInjecting Certainty Into An Uncertain Process
Injecting Certainty Into An Uncertain Process
 
Lessons learned - Startup #growth
Lessons learned - Startup #growthLessons learned - Startup #growth
Lessons learned - Startup #growth
 
Startup entrepreneurship with Shlomo Maital
Startup entrepreneurship with Shlomo MaitalStartup entrepreneurship with Shlomo Maital
Startup entrepreneurship with Shlomo Maital
 
To the moon: scaling startups with Rocket Internet
To the moon: scaling startups with Rocket InternetTo the moon: scaling startups with Rocket Internet
To the moon: scaling startups with Rocket Internet
 
LTV Predictions: How do real-life companies use them & what can you learn fro...
LTV Predictions: How do real-life companies use them & what can you learn fro...LTV Predictions: How do real-life companies use them & what can you learn fro...
LTV Predictions: How do real-life companies use them & what can you learn fro...
 
Corporate Innovation - Challenges of Lean Startup inside a Fortune 25
Corporate Innovation - Challenges of Lean Startup inside a Fortune 25Corporate Innovation - Challenges of Lean Startup inside a Fortune 25
Corporate Innovation - Challenges of Lean Startup inside a Fortune 25
 
Pitch incredibly
Pitch incrediblyPitch incredibly
Pitch incredibly
 
Stochastic Modeling - Financial Reporting
Stochastic Modeling - Financial ReportingStochastic Modeling - Financial Reporting
Stochastic Modeling - Financial Reporting
 
Data-driven Product Management
Data-driven Product ManagementData-driven Product Management
Data-driven Product Management
 
Mairi robertson nmp - workshop 2
Mairi robertson   nmp - workshop 2Mairi robertson   nmp - workshop 2
Mairi robertson nmp - workshop 2
 
Lean Innovation at UnitedHealth Group, Kunjorn Chambungdabongse, Optum
Lean Innovation at UnitedHealth Group, Kunjorn Chambungdabongse, OptumLean Innovation at UnitedHealth Group, Kunjorn Chambungdabongse, Optum
Lean Innovation at UnitedHealth Group, Kunjorn Chambungdabongse, Optum
 
1530 track 1 fader_using our laptop
1530 track 1 fader_using our laptop1530 track 1 fader_using our laptop
1530 track 1 fader_using our laptop
 
How to Dominate the Marketplace with a Great Product & Winning Business Strategy
How to Dominate the Marketplace with a Great Product & Winning Business StrategyHow to Dominate the Marketplace with a Great Product & Winning Business Strategy
How to Dominate the Marketplace with a Great Product & Winning Business Strategy
 
Bundledarrows150 bit.ly/teamcaptainsmanagementcampsv
Bundledarrows150 bit.ly/teamcaptainsmanagementcampsvBundledarrows150 bit.ly/teamcaptainsmanagementcampsv
Bundledarrows150 bit.ly/teamcaptainsmanagementcampsv
 
Slides from StartupTalk #5 - Mikkel Sørensen, CEO of Omnio
Slides from StartupTalk #5 - Mikkel Sørensen, CEO of OmnioSlides from StartupTalk #5 - Mikkel Sørensen, CEO of Omnio
Slides from StartupTalk #5 - Mikkel Sørensen, CEO of Omnio
 
Machine Learning and Analytics Breakout Session
Machine Learning and Analytics Breakout SessionMachine Learning and Analytics Breakout Session
Machine Learning and Analytics Breakout Session
 
Apply AI Finance Webinar.pdf
Apply AI Finance Webinar.pdfApply AI Finance Webinar.pdf
Apply AI Finance Webinar.pdf
 

Recently uploaded

Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
gajnagarg
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
nirzagarg
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
nirzagarg
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Klinik kandungan
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
chadhar227
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
vexqp
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
Health
 

Recently uploaded (20)

Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Harnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxHarnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptx
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - Almora
 
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxThe-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 

Modeling the Stock Market: Common pitfalls and how to avoid them!

  • 1. Modeling the Stock Market: Common pitfalls… and how to avoid them! Jess Stauth Portfolio Management and Research Jess@quantopian.com / @jstauth
  • 2. Disclaimer Quantopian provides this presentation to help people write trading algorithms - it is not intended to provide investment advice. More specifically, the material is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory or other services by Quantopian. In addition, the content neither constitutes investment advice nor offers any opinion with respect to the suitability of any security or any specific investment.
  • 3. Motivation Building a beautiful backtest is easy! But… Don’t expect anyone to pay you for it! Building a model that predicts the future is HARD! But… Many people will fight to pay you a lot for doing that!
  • 4. Ok, so it’s hard. I love hard work! What’s the catch? • It can be hard to know when you have what you want – aka “future predictor”! • We “simulate” the future (usually using the past!) to validate our model • But what if our simulation doesn’t match reality? • Or our data was flawed? • Or we just got lucky? • Or… Idea Data Research/ Build model Simulate Trade $$$
  • 5. Common pitfalls that turn into 1. Overfitting 2. Overtrading 3. Non-stationary processes / regime changes 4. Lookahead aka “time travel illusion” 5. Model complexity
  • 7. 1. Overfitting Real world example: The incredible shrinking portfolio Example from A Quantopian author / model developer in diligence. A robust ‘information rich’ signal should show stable or increasingly good performance (Sharpe ratio) as you increase the number of assets included. Fundamental law of active management*: IR = IC * sqrt(N) Finding that your signal is degraded by expanding the number of assets scored is a red flag that you may have identified an unstable, noisy, or spurious effect How to avoid: Take care not to ‘over optimize’ your model on a small number of data points (in our use case those are assets/ stock tickers) *Grinold and Kahn. Active Portfolio Management – pdf online
  • 8. This phenomenon of overly concentrated portfolios turned out to be prevalent in the submissions to Quantopian’s daily contest. In a ‘tearsheet feedback’ thread and webinar we highlighted this pitfall. We ran a second feedback session a few weeks later and…
  • 9. 2. Overtrading – three real examples Algo A Algo B Algo C “low” costs “high” costs Trading algorithms developed with the assumption of “low” (or no) cost of trading in the markets often show unrealistically good returns. How to avoid: Using conservative cost estimates, and looking at the sensitivity of your stock market model to the underlying assumption of what your costs will be can be the difference between profits and losses in the real world!
  • 10. 3. Regime Shift/Non-stationarity • Many common time-series techniques assume data are stationary (constant mean and variance). • Imagine doing all your research on data from 2016/17 and evaluating a model that makes money shorting volatility… • How to avoid: Know that markets are always changing and make sure to backtest over long enough time ranges to see regime changes that might impact your model. Vol Regimes – Quantopian Blog
  • 11. 4. Time travel illusion: What did you know and when did you know it? • Classic date alignment fail examples: • Drop the timestamp from close prices and build a daily technical factor... You’ll prove that knowing the 4pm price at 9am would be super valuable! • Modeling earnings surprises and assuming your model knows actual reported earnings on quarter end dates, when IRL you don’t get them for 45+ DAYS after… • How to avoid: Same principle as with modeling market impact, be conservative with your assumptions about data timeliness and check your strategy’s robustness to lagged data over a range of lags.
  • 13. Resources: • https://blog.quantopian.com/9-mistakes-quants-make-that-cause- backtests-to-lie-by-tucker-balch-ph-d/ • ^Tucker Balch recorded talk QuantCon 2015 • Lots of other great stuff on Quantopian’s Youtube Channel • Quantopian Lectures Thank you! Questions? Do you have a unique idea and think you’ve avoided these pitfalls? Enter the Quantopian Contest and find out if you’re smarter than the average Quantopian user! www.quantopian.com/contest Jess@quantopian.com / @jstauth

Editor's Notes

  1. Stationarity. A common assumption in many time series techniques is that the data are stationary. A stationary process has the property that the mean, variance and autocorrelation structure do not changeover time.
  2. “With four parameters I can fit an elephant, and with five I can make him wiggle his trunk” John von Neumann