SlideShare a Scribd company logo
1 of 25
Portfolio and Risk Analytics in Python with pyfolio
PyData NYC 2015
Jessica Stauth
VP Quant Strategy
Justin Lent, Thomas Weicki PhD, Andrew Campbell
#PyData #PyDataNYC 1
Why use Python for Quant Finance?
• Python is a general purpose language
• No hodge-podge of perl, bash, matlab, R, excel
fortran.
• Very easy to learn.
#PyData #PyDataNYC 2
The Quant Finance PyData Stack
• Source: [Jake VanderPlas: State of the Tools]
– (https://www.youtube.com/watch?v=5GlNDD7qbP4)#PyData #PyDataNYC 3
Python in Quantitative Finance
• When Quantopian started in 2011, we needed a backtester
– Open-sourced Zipline in 2012
• When we started to build a crowd-source hedge fund, we
needed a better way to evaluate algorithms
– Open-sourced pyfolio in 2015
#PyData #PyDataNYC 4
pyfolio
• State-of-the-art portfolio and risk analytics
http://quantopian.github.io/pyfolio/
• Open source and free: Apache v2 license
• Can be used:
– stand alone
– with Zipline
– on Quantopian in a hosted Research Environment
– with PyThalesians
#PyData #PyDataNYC 5
Using pyfolio stand-alone
• Installation
• Use Anaconda to get a Python system with the full
PyData ecosystem. Then:
• pip install pyfolio
• Import it in your project
#PyData #PyDataNYC 6
Tearsheets analysis package
Visualizations
• Daily returns of a stock, or trading strategy
• Positions
• Transactions
• Periods of market stress
• Bayesian risk analyses
#PyData #PyDataNYC 7
Tearsheet Components
#PyData #PyDataNYC 8
#PyData #PyDataNYC 9
#PyData #PyDataNYC 10
#PyData #PyDataNYC 11
#PyData #PyDataNYC 12
Long/Short Exposure over Time
#PyData #PyDataNYC 13
Sector Exposure over Time
#PyData #PyDataNYC 14
Slippage and Transaction Cost Sensitivity
#PyData #PyDataNYC 15
Zipline + pyfolio, locally or via quantopian.com
• Zipline: open-source backtester by Quantopian
• Powers quantopian.com
– 12 years of stock market data for US Equities (minute-bar
prices, corporate fundamentals, sentiment, events, etc.)
– Various models for transaction costs and slippage.
– Web based IDE for creating and deploying trading algorithms
• Hosted ipython notebook research server
– Ad-hoc data analysis. We provide market data.
– Pull in strategy backtest results from the Web IDE and use
pyfolio
#PyData #PyDataNYC 16
Bayesian analysis in pyfolio
• Sneak-peek into ongoing research.
• Can a backtest (in-sample data) be used to predict the future results
(out of sample data)?
• Sophisticated statistical modeling takes uncertainty into account.
• Uses T-distribution to model returns (instead of normal).
– Addresses ‘fat-tail’ nature of financial returns
• Relies on PyMC3.
– Python module for Bayesian statistical modeling and model fitting which
focuses on advanced Markov chain Monte Carlo fitting algorithms.
#PyData #PyDataNYC 17
Modeling Trading Strategy Uncertainty with Bayesian Analysis
How do I know my trading
strategy is “working” after I’ve
put real $ into it?
How many Out-of-Sample trading
days must be observed for me to
be certain?
Calculate: P(mean > 0)
(Probability of out-of-sample means > 0%)
Re-compute model as new data is sampled.
#PyData #PyDataNYC 18
Modeling Trading Strategy Uncertainty with Bayesian Analysis
#PyData #PyDataNYC 19
Bayesian analysis – real world example
#PyData #PyDataNYC 20
paper
trading
Bayesian analysis – real world example
#PyData #PyDataNYC 21
!
Bayesian analysis – real world example
#PyData #PyDataNYC 22
June2015
Nov2015
Backtest – “in-sample”
More Info on Bayesian Analysis
Accompanying blog post:
http://blog.quantopian.com/bayesian-cone/
Bayesian Methods for Hackers:
http://camdavidsonpilon.github.io/Probabilistic-Programming-and-
Bayesian-Methods-for-Hackers/
PyMC3: http://pymc-devs.github.io/pymc3
#PyData #PyDataNYC 23
Summary
• Pyfolio bundles various useful analyses and includes
advanced statistical modeling.
• “Using pyfolio” webinar tutorial:
https://www.youtube.com/watch?v=-VmZAlBWUko
• Still young -- please contribute:
https://github.com/quantopian/pyfolio/labels/help%2
0wanted
• Bugs: https://github.com/quantopian/pyfolio/issues
#PyData #PyDataNYC 24
Up next right here: Andrew Campbell - Bootstrapping
Applications and Dashboards with IPython Widgets
Tomorrow 4:25pm Room A: Scott Sandersen –
Developing an Expression Language for Quantitative
Financial Modeling
jstauth@quantopian.com
@jstauth
www.quantopian.com/fund
Thank you.
Questions?
#PyData #PyDataNYC 25

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
 
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
 
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
 
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
 
A Guided Tour of Machine Learning for Traders by Tucker Balch at QuantCon 2016
A Guided Tour of Machine Learning for Traders by Tucker Balch at QuantCon 2016A Guided Tour of Machine Learning for Traders by Tucker Balch at QuantCon 2016
A Guided Tour of Machine Learning for Traders by Tucker Balch 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
 
Tearsheet feedback webinar 10.10.18
Tearsheet feedback webinar 10.10.18Tearsheet feedback webinar 10.10.18
Tearsheet feedback webinar 10.10.18Quantopian
 
"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
 
"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
 
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
 
"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
 
Using Domain Expertise to Improve Text Analysis, Evan Schnidman, Founder and ...
Using Domain Expertise to Improve Text Analysis, Evan Schnidman, Founder and ...Using Domain Expertise to Improve Text Analysis, Evan Schnidman, Founder and ...
Using Domain Expertise to Improve Text Analysis, Evan Schnidman, Founder and ...Quantopian
 
Risk Management: Maximising Long-Term Growth Presentation
Risk Management: Maximising Long-Term Growth PresentationRisk Management: Maximising Long-Term Growth Presentation
Risk Management: Maximising Long-Term Growth PresentationQuantInsti
 
"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
 
"How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ...
"How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ..."How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ...
"How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ...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
 

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...
 
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
 
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
 
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...
 
A Guided Tour of Machine Learning for Traders by Tucker Balch at QuantCon 2016
A Guided Tour of Machine Learning for Traders by Tucker Balch at QuantCon 2016A Guided Tour of Machine Learning for Traders by Tucker Balch at QuantCon 2016
A Guided Tour of Machine Learning for Traders by Tucker Balch 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. ...
 
Tearsheet feedback webinar 10.10.18
Tearsheet feedback webinar 10.10.18Tearsheet feedback webinar 10.10.18
Tearsheet feedback webinar 10.10.18
 
"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 ...
 
"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
 
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
 
"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...
 
Using Domain Expertise to Improve Text Analysis, Evan Schnidman, Founder and ...
Using Domain Expertise to Improve Text Analysis, Evan Schnidman, Founder and ...Using Domain Expertise to Improve Text Analysis, Evan Schnidman, Founder and ...
Using Domain Expertise to Improve Text Analysis, Evan Schnidman, Founder and ...
 
Risk Management: Maximising Long-Term Growth Presentation
Risk Management: Maximising Long-Term Growth PresentationRisk Management: Maximising Long-Term Growth Presentation
Risk Management: Maximising Long-Term Growth Presentation
 
"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...
 
"How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ...
"How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ..."How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ...
"How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ...
 
QuantConnect - Options Backtesting
QuantConnect - Options BacktestingQuantConnect - Options Backtesting
QuantConnect - Options Backtesting
 
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
 

Viewers also liked

Building a Quantitative Trading Strategy To Beat the S&P500
Building a Quantitative Trading Strategy To Beat the S&P500Building a Quantitative Trading Strategy To Beat the S&P500
Building a Quantitative Trading Strategy To Beat the S&P500Karen Rubin
 
An introduction to reinforcement learning (rl)
An introduction to reinforcement learning (rl)An introduction to reinforcement learning (rl)
An introduction to reinforcement learning (rl)pauldix
 
Introduction to Reinforcement Learning
Introduction to Reinforcement LearningIntroduction to Reinforcement Learning
Introduction to Reinforcement LearningEdward Balaban
 
Trade Like a Chimp: Unleash Your Inner Primate by Andreas Clenow at QuantCon ...
Trade Like a Chimp: Unleash Your Inner Primate by Andreas Clenow at QuantCon ...Trade Like a Chimp: Unleash Your Inner Primate by Andreas Clenow at QuantCon ...
Trade Like a Chimp: Unleash Your Inner Primate by Andreas Clenow at QuantCon ...Quantopian
 
Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...
Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...
Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...Quantopian
 
Reinforcement Learning : A Beginners Tutorial
Reinforcement Learning : A Beginners TutorialReinforcement Learning : A Beginners Tutorial
Reinforcement Learning : A Beginners TutorialOmar Enayet
 
Dual Momentum Investing by Gary Antonacci QuantCon 2016
Dual Momentum Investing by Gary Antonacci QuantCon 2016Dual Momentum Investing by Gary Antonacci QuantCon 2016
Dual Momentum Investing by Gary Antonacci QuantCon 2016Quantopian
 
How to design quant trading strategies using “R”?
How to design quant trading strategies using “R”?How to design quant trading strategies using “R”?
How to design quant trading strategies using “R”?QuantInsti
 
Reinforcement learning
Reinforcement learning Reinforcement learning
Reinforcement learning Chandra Meena
 
Presentation on supervised learning
Presentation on supervised learningPresentation on supervised learning
Presentation on supervised learningTonmoy Bhagawati
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine LearningRahul Jain
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine LearningLior Rokach
 

Viewers also liked (13)

Building a Quantitative Trading Strategy To Beat the S&P500
Building a Quantitative Trading Strategy To Beat the S&P500Building a Quantitative Trading Strategy To Beat the S&P500
Building a Quantitative Trading Strategy To Beat the S&P500
 
Mean Reversion
Mean ReversionMean Reversion
Mean Reversion
 
An introduction to reinforcement learning (rl)
An introduction to reinforcement learning (rl)An introduction to reinforcement learning (rl)
An introduction to reinforcement learning (rl)
 
Introduction to Reinforcement Learning
Introduction to Reinforcement LearningIntroduction to Reinforcement Learning
Introduction to Reinforcement Learning
 
Trade Like a Chimp: Unleash Your Inner Primate by Andreas Clenow at QuantCon ...
Trade Like a Chimp: Unleash Your Inner Primate by Andreas Clenow at QuantCon ...Trade Like a Chimp: Unleash Your Inner Primate by Andreas Clenow at QuantCon ...
Trade Like a Chimp: Unleash Your Inner Primate by Andreas Clenow at QuantCon ...
 
Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...
Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...
Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...
 
Reinforcement Learning : A Beginners Tutorial
Reinforcement Learning : A Beginners TutorialReinforcement Learning : A Beginners Tutorial
Reinforcement Learning : A Beginners Tutorial
 
Dual Momentum Investing by Gary Antonacci QuantCon 2016
Dual Momentum Investing by Gary Antonacci QuantCon 2016Dual Momentum Investing by Gary Antonacci QuantCon 2016
Dual Momentum Investing by Gary Antonacci QuantCon 2016
 
How to design quant trading strategies using “R”?
How to design quant trading strategies using “R”?How to design quant trading strategies using “R”?
How to design quant trading strategies using “R”?
 
Reinforcement learning
Reinforcement learning Reinforcement learning
Reinforcement learning
 
Presentation on supervised learning
Presentation on supervised learningPresentation on supervised learning
Presentation on supervised learning
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
 

Similar to PyData NYC 2015

Data Science With Python | Python For Data Science | Python Data Science Cour...
Data Science With Python | Python For Data Science | Python Data Science Cour...Data Science With Python | Python For Data Science | Python Data Science Cour...
Data Science With Python | Python For Data Science | Python Data Science Cour...Simplilearn
 
"Applying Deep Learning Techniques to Financial Time Series" by Scott Treloar...
"Applying Deep Learning Techniques to Financial Time Series" by Scott Treloar..."Applying Deep Learning Techniques to Financial Time Series" by Scott Treloar...
"Applying Deep Learning Techniques to Financial Time Series" by Scott Treloar...Quantopian
 
Accelerating and financing London’s start ups
 Accelerating and financing London’s start ups Accelerating and financing London’s start ups
Accelerating and financing London’s start upsCapitalEnterpriseLDN
 
No, you don't need to learn python
No, you don't need to learn pythonNo, you don't need to learn python
No, you don't need to learn pythonQuantUniversity
 
Productive Data Tools for Quants
Productive Data Tools for QuantsProductive Data Tools for Quants
Productive Data Tools for QuantsWes McKinney
 
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALSPYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALSQuantUniversity
 
Machine Learning with PyCaret
Machine Learning with PyCaretMachine Learning with PyCaret
Machine Learning with PyCaretDatabricks
 
Introduction To Data Science With Python
Introduction To Data Science With PythonIntroduction To Data Science With Python
Introduction To Data Science With PythonSpotle.ai
 
Get Started with Quantiacs
Get Started with QuantiacsGet Started with Quantiacs
Get Started with QuantiacsQuantiacs
 
Python Certification | Data Science with Python Certification | Python Online...
Python Certification | Data Science with Python Certification | Python Online...Python Certification | Data Science with Python Certification | Python Online...
Python Certification | Data Science with Python Certification | Python Online...Edureka!
 
American Century (Revolution Analytics Customer Day)
American Century (Revolution Analytics Customer Day)American Century (Revolution Analytics Customer Day)
American Century (Revolution Analytics Customer Day)Revolution Analytics
 
DataTalks #4: Необходимый минимум инструментов для построения своей системы р...
DataTalks #4: Необходимый минимум инструментов для построения своей системы р...DataTalks #4: Необходимый минимум инструментов для построения своей системы р...
DataTalks #4: Необходимый минимум инструментов для построения своей системы р...WG_ Events
 
Pinterest - Big Data Machine Learning Platform at Pinterest
Pinterest - Big Data Machine Learning Platform at PinterestPinterest - Big Data Machine Learning Platform at Pinterest
Pinterest - Big Data Machine Learning Platform at PinterestAlluxio, Inc.
 
Defcon Blue Team Village 2020: Purple On My Mind: Cost Effective Automated Ad...
Defcon Blue Team Village 2020: Purple On My Mind: Cost Effective Automated Ad...Defcon Blue Team Village 2020: Purple On My Mind: Cost Effective Automated Ad...
Defcon Blue Team Village 2020: Purple On My Mind: Cost Effective Automated Ad...Mauricio Velazco
 
A Year of Pyxley: My First Open Source Adventure
A Year of Pyxley: My First Open Source AdventureA Year of Pyxley: My First Open Source Adventure
A Year of Pyxley: My First Open Source AdventureNick Kridler
 
🌟Is Learning Python Your Career Game-Changer? 🚀🐍
🌟Is Learning Python Your  Career Game-Changer? 🚀🐍🌟Is Learning Python Your  Career Game-Changer? 🚀🐍
🌟Is Learning Python Your Career Game-Changer? 🚀🐍abhishekdf3
 
Building a Beer Recommender with Yhat (PAPIs.io - November 2014)
Building a Beer Recommender with Yhat (PAPIs.io - November 2014)Building a Beer Recommender with Yhat (PAPIs.io - November 2014)
Building a Beer Recommender with Yhat (PAPIs.io - November 2014)Austin Ogilvie
 
Innovative Data Leveraging for Procurement Analytics
Innovative Data Leveraging for Procurement AnalyticsInnovative Data Leveraging for Procurement Analytics
Innovative Data Leveraging for Procurement AnalyticsTejari
 

Similar to PyData NYC 2015 (20)

Python ml
Python mlPython ml
Python ml
 
Data Science With Python | Python For Data Science | Python Data Science Cour...
Data Science With Python | Python For Data Science | Python Data Science Cour...Data Science With Python | Python For Data Science | Python Data Science Cour...
Data Science With Python | Python For Data Science | Python Data Science Cour...
 
"Applying Deep Learning Techniques to Financial Time Series" by Scott Treloar...
"Applying Deep Learning Techniques to Financial Time Series" by Scott Treloar..."Applying Deep Learning Techniques to Financial Time Series" by Scott Treloar...
"Applying Deep Learning Techniques to Financial Time Series" by Scott Treloar...
 
Accelerating and financing London’s start ups
 Accelerating and financing London’s start ups Accelerating and financing London’s start ups
Accelerating and financing London’s start ups
 
No, you don't need to learn python
No, you don't need to learn pythonNo, you don't need to learn python
No, you don't need to learn python
 
Productive Data Tools for Quants
Productive Data Tools for QuantsProductive Data Tools for Quants
Productive Data Tools for Quants
 
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALSPYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
 
Machine Learning with PyCaret
Machine Learning with PyCaretMachine Learning with PyCaret
Machine Learning with PyCaret
 
Introduction To Data Science With Python
Introduction To Data Science With PythonIntroduction To Data Science With Python
Introduction To Data Science With Python
 
Get Started with Quantiacs
Get Started with QuantiacsGet Started with Quantiacs
Get Started with Quantiacs
 
Get Started with Quantiacs
Get Started with QuantiacsGet Started with Quantiacs
Get Started with Quantiacs
 
Python Certification | Data Science with Python Certification | Python Online...
Python Certification | Data Science with Python Certification | Python Online...Python Certification | Data Science with Python Certification | Python Online...
Python Certification | Data Science with Python Certification | Python Online...
 
American Century (Revolution Analytics Customer Day)
American Century (Revolution Analytics Customer Day)American Century (Revolution Analytics Customer Day)
American Century (Revolution Analytics Customer Day)
 
DataTalks #4: Необходимый минимум инструментов для построения своей системы р...
DataTalks #4: Необходимый минимум инструментов для построения своей системы р...DataTalks #4: Необходимый минимум инструментов для построения своей системы р...
DataTalks #4: Необходимый минимум инструментов для построения своей системы р...
 
Pinterest - Big Data Machine Learning Platform at Pinterest
Pinterest - Big Data Machine Learning Platform at PinterestPinterest - Big Data Machine Learning Platform at Pinterest
Pinterest - Big Data Machine Learning Platform at Pinterest
 
Defcon Blue Team Village 2020: Purple On My Mind: Cost Effective Automated Ad...
Defcon Blue Team Village 2020: Purple On My Mind: Cost Effective Automated Ad...Defcon Blue Team Village 2020: Purple On My Mind: Cost Effective Automated Ad...
Defcon Blue Team Village 2020: Purple On My Mind: Cost Effective Automated Ad...
 
A Year of Pyxley: My First Open Source Adventure
A Year of Pyxley: My First Open Source AdventureA Year of Pyxley: My First Open Source Adventure
A Year of Pyxley: My First Open Source Adventure
 
🌟Is Learning Python Your Career Game-Changer? 🚀🐍
🌟Is Learning Python Your  Career Game-Changer? 🚀🐍🌟Is Learning Python Your  Career Game-Changer? 🚀🐍
🌟Is Learning Python Your Career Game-Changer? 🚀🐍
 
Building a Beer Recommender with Yhat (PAPIs.io - November 2014)
Building a Beer Recommender with Yhat (PAPIs.io - November 2014)Building a Beer Recommender with Yhat (PAPIs.io - November 2014)
Building a Beer Recommender with Yhat (PAPIs.io - November 2014)
 
Innovative Data Leveraging for Procurement Analytics
Innovative Data Leveraging for Procurement AnalyticsInnovative Data Leveraging for Procurement Analytics
Innovative Data Leveraging for Procurement Analytics
 

Recently uploaded

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 

Recently uploaded (20)

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

PyData NYC 2015

  • 1. Portfolio and Risk Analytics in Python with pyfolio PyData NYC 2015 Jessica Stauth VP Quant Strategy Justin Lent, Thomas Weicki PhD, Andrew Campbell #PyData #PyDataNYC 1
  • 2. Why use Python for Quant Finance? • Python is a general purpose language • No hodge-podge of perl, bash, matlab, R, excel fortran. • Very easy to learn. #PyData #PyDataNYC 2
  • 3. The Quant Finance PyData Stack • Source: [Jake VanderPlas: State of the Tools] – (https://www.youtube.com/watch?v=5GlNDD7qbP4)#PyData #PyDataNYC 3
  • 4. Python in Quantitative Finance • When Quantopian started in 2011, we needed a backtester – Open-sourced Zipline in 2012 • When we started to build a crowd-source hedge fund, we needed a better way to evaluate algorithms – Open-sourced pyfolio in 2015 #PyData #PyDataNYC 4
  • 5. pyfolio • State-of-the-art portfolio and risk analytics http://quantopian.github.io/pyfolio/ • Open source and free: Apache v2 license • Can be used: – stand alone – with Zipline – on Quantopian in a hosted Research Environment – with PyThalesians #PyData #PyDataNYC 5
  • 6. Using pyfolio stand-alone • Installation • Use Anaconda to get a Python system with the full PyData ecosystem. Then: • pip install pyfolio • Import it in your project #PyData #PyDataNYC 6
  • 7. Tearsheets analysis package Visualizations • Daily returns of a stock, or trading strategy • Positions • Transactions • Periods of market stress • Bayesian risk analyses #PyData #PyDataNYC 7
  • 13. Long/Short Exposure over Time #PyData #PyDataNYC 13
  • 14. Sector Exposure over Time #PyData #PyDataNYC 14
  • 15. Slippage and Transaction Cost Sensitivity #PyData #PyDataNYC 15
  • 16. Zipline + pyfolio, locally or via quantopian.com • Zipline: open-source backtester by Quantopian • Powers quantopian.com – 12 years of stock market data for US Equities (minute-bar prices, corporate fundamentals, sentiment, events, etc.) – Various models for transaction costs and slippage. – Web based IDE for creating and deploying trading algorithms • Hosted ipython notebook research server – Ad-hoc data analysis. We provide market data. – Pull in strategy backtest results from the Web IDE and use pyfolio #PyData #PyDataNYC 16
  • 17. Bayesian analysis in pyfolio • Sneak-peek into ongoing research. • Can a backtest (in-sample data) be used to predict the future results (out of sample data)? • Sophisticated statistical modeling takes uncertainty into account. • Uses T-distribution to model returns (instead of normal). – Addresses ‘fat-tail’ nature of financial returns • Relies on PyMC3. – Python module for Bayesian statistical modeling and model fitting which focuses on advanced Markov chain Monte Carlo fitting algorithms. #PyData #PyDataNYC 17
  • 18. Modeling Trading Strategy Uncertainty with Bayesian Analysis How do I know my trading strategy is “working” after I’ve put real $ into it? How many Out-of-Sample trading days must be observed for me to be certain? Calculate: P(mean > 0) (Probability of out-of-sample means > 0%) Re-compute model as new data is sampled. #PyData #PyDataNYC 18
  • 19. Modeling Trading Strategy Uncertainty with Bayesian Analysis #PyData #PyDataNYC 19
  • 20. Bayesian analysis – real world example #PyData #PyDataNYC 20 paper trading
  • 21. Bayesian analysis – real world example #PyData #PyDataNYC 21 !
  • 22. Bayesian analysis – real world example #PyData #PyDataNYC 22 June2015 Nov2015 Backtest – “in-sample”
  • 23. More Info on Bayesian Analysis Accompanying blog post: http://blog.quantopian.com/bayesian-cone/ Bayesian Methods for Hackers: http://camdavidsonpilon.github.io/Probabilistic-Programming-and- Bayesian-Methods-for-Hackers/ PyMC3: http://pymc-devs.github.io/pymc3 #PyData #PyDataNYC 23
  • 24. Summary • Pyfolio bundles various useful analyses and includes advanced statistical modeling. • “Using pyfolio” webinar tutorial: https://www.youtube.com/watch?v=-VmZAlBWUko • Still young -- please contribute: https://github.com/quantopian/pyfolio/labels/help%2 0wanted • Bugs: https://github.com/quantopian/pyfolio/issues #PyData #PyDataNYC 24
  • 25. Up next right here: Andrew Campbell - Bootstrapping Applications and Dashboards with IPython Widgets Tomorrow 4:25pm Room A: Scott Sandersen – Developing an Expression Language for Quantitative Financial Modeling jstauth@quantopian.com @jstauth www.quantopian.com/fund Thank you. Questions? #PyData #PyDataNYC 25