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
 
"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...Quantopian
 
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
 
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 Fundkelmstrom
 
Tearsheet feedback webinar 10.10.18
Tearsheet feedback webinar 10.10.18Tearsheet feedback webinar 10.10.18
Tearsheet feedback webinar 10.10.18Quantopian
 
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 2016Quantopian
 
"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. ...Quantopian
 
"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 ...Quantopian
 
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...Quantopian
 
"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...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
 
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 RoitmanI Know First: Daily Market Forecast
 
"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...Quantopian
 
"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...Quantopian
 
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 PlatformQuantopian
 
"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...Quantopian
 
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 SingaporeQuantInsti
 
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...Quantopian
 
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
 
Quantopian: Crowd-sourced Systematic Alpha
Quantopian: Crowd-sourced Systematic AlphaQuantopian: Crowd-sourced Systematic Alpha
Quantopian: Crowd-sourced Systematic AlphaQuantopian
 

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!

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 27VentureArchetypes LLC
 
Machine learning for factor investing
Machine learning for factor investingMachine learning for factor investing
Machine learning for factor investingQuantUniversity
 
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 SimulationSam McAfee
 
Injecting Certainty Into An Uncertain Process
Injecting Certainty Into An Uncertain ProcessInjecting Certainty Into An Uncertain Process
Injecting Certainty Into An Uncertain ProcessJerry Scherer
 
Lessons learned - Startup #growth
Lessons learned - Startup #growthLessons learned - Startup #growth
Lessons learned - Startup #growthStylight
 
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 InternetStephan Spijkers
 
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 25Kunjorn Chambundabongse
 
Stochastic Modeling - Financial Reporting
Stochastic Modeling - Financial ReportingStochastic Modeling - Financial Reporting
Stochastic Modeling - Financial ReportingRon Harasym
 
Data-driven Product Management
Data-driven Product ManagementData-driven Product Management
Data-driven Product ManagementTathagat Varma
 
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, OptumLean Startup Co.
 
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 laptopRising Media, Inc.
 
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 StrategyJoseph Essien
 
Bundledarrows150 bit.ly/teamcaptainsmanagementcampsv
Bundledarrows150 bit.ly/teamcaptainsmanagementcampsvBundledarrows150 bit.ly/teamcaptainsmanagementcampsv
Bundledarrows150 bit.ly/teamcaptainsmanagementcampsvshadowboxingtv
 
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 OmnioPreSeed Ventures
 
Machine Learning and Analytics Breakout Session
Machine Learning and Analytics Breakout SessionMachine Learning and Analytics Breakout Session
Machine Learning and Analytics Breakout SessionSplunk
 
Apply AI Finance Webinar.pdf
Apply AI Finance Webinar.pdfApply AI Finance Webinar.pdf
Apply AI Finance Webinar.pdftevinek
 

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

Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 

Recently uploaded (20)

Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 

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