SlideShare a Scribd company logo
1 of 18
Download to read offline
Dr Luiz Guedes
Occam Brasil
Pairs Trading In the Brazilian Stock Market
Statistical Arbitrage Concepts
• Arbitrage: Trade operation free of risk
• Statistical Arbitrage: Use of Statistics to find Trade operations (almost) free of risk
• Pairs Trading: Statistical arbitrage model based on finding asset pairs that mutually
(almost) neutralize each other’s risk.
• Dollar neutral, Beta neutral, Alpha neutral,...
• Cointegrated pair: Pair of assets that can be linearly combined to produce a
stationary time series
• Stationary time series: Time series with constant mean and variance
Cointegrated Pairs
BOVA11.SA - 0.956735 * BOVV11.SA
ALUP4.SA - 0.5876 * CPLE3.SA
Pairs Trading Backtest Algorithm
1. Identify Sectors and Tickers
2. For each Sector
1. Find cointegrating pairs for the training period
2. Get cointegrating pairs hedge ratio (Johansen test)
3. For each pair
1. Calculate pairs spread for the test period using training period
hedge ratio
2. Run Bollinger Band Trading strategy for testing period
3. Save results
Training Period Testing
Train start Train end = Test start -1 Test end
Backtest Process
Training Period Testing
Training Period Testing
Training Period Testing
Training Period Testing
...
Training Period Testing
Train start Train end = Test start -1 Test end
x
Pairs Trading Backtest Algorithm
1. Identify Sectors and Tickers
2. While period <= lastPeriod
1. For each Sector
1. Find cointegrating pairs for the training period
2. Get cointegrating pairs hedge ratio (Johansen test)
3. For each pair
1. Calculate pairs spread for the test period using training period hedge
ratio
2. Run Bollinger Band Trading strategy for testing period
3. Save results
2. Advance to next period
Bollinger Band Strategy
Sell
Close
Buy
Close
Buy
Close
Suffer!!
Sell
Close
Buy
Close?
Buy
Close
Exit?
Bollinger Band Strategy with Stop Loss?
Bollinger Band Strategy with Stop Loss / Stop Time!
Sell
Close
Buy
Close
Buy
SL Exit!!
Sell
Close
ST Exit!!
Bollinger Band Trading
JHSF3.SA - 1.3316 * MRVE3.SA
Project BackTest Process
Training Period Testing
2018-01-01 2020-04-30 2021-04-30
Training Period Testing
2009-01-01 2014-01-01 2014-12-31
Survivorship Bias!!!
Brazil Stock Market Sectors with Size
oil: 9
metal: 4
steel: 5
paper: 4
transp_material: 7
machines: 10
rail_roads: 3
highways: 3
storage: 2
services: 6
agriculture: 4
meat: 6
food: 4
construction: 25
fabric: 10
clothes_shoes: 14
education: 6
car_rental: 4
retail: 10
hospitals: 10
drugstores: 6
it: 11
telecom: 4
electricity: 37
water: 6
banking: 21
financial_services: 6
insurance: 8
real_estate: 16
Hindsight obs: Too many small sectors.
Pairs per Sector
#sectors x #pairs 1-Jan-2009 to 31-Dec-2014 1-Jan-2018 to 30-Apr-2021
All (sectors larger than 5) 10 x 750 15 x 1098
Cointegrated (signific >
90%)
10 x 393 15 x 442
Constant sign 10 x 333 14 x 361
Half-life <= 60 4 x 89 12 x 140
Pairs per Sector – IBrX100
#sectors x #pairs All Top 100
All (sectors larger than 5) 15 x 1098 5 x 81
Cointegrated (signific >
90%)
15 x 442 5 x 21
Constant sign 14 x 361 4 x 18
Half-life <= 60 12 x 140 3 x 5
Backtest results
2020-05-01 to 2021-05-01 - Top 100:
Pair CAGR Hit Ratio Avg Profit/Loss Rets StdDev Max Draw-down
('ARZZ3.SA', 'HGTX3.SA') 1.23 2.60 2.33 0.37 -11.07%
('JHSF3.SA', 'MRVE3.SA') 0.72 4.33 0.80 0.19 -19.31%
('CMIG4.SA', 'CPFE3.SA') 0.58 3.00 1.46 0.20 -4.43%
('CPFE3.SA', 'ENBR3.SA') 0.36 2.00 1.44 0.13 -5.43%
('ENBR3.SA', 'TRPL4.SA') 0.10 1.00 1.35 0.08 -22.27%
2014-01-01 to 2015-01-01 - All
Pair CAGR Hit Ratio Avg Profit/Loss Rets StdDev Max Draw-down
('CBEE3.SA', 'EKTR4.SA') 5.18 15.00 4.50 1.36 -2.94%
('BAZA3.SA', 'BNBR3.SA') 4.62 6.00 1.58 1.62 -12.25%
('BAZA3.SA', 'BMIN4.SA') 4.11 8.50 1.09 0.99 -17.30%
('CTSA4.SA', 'TXRX4.SA') 2.39 2.50 1.54 0.69 -45.70%
('BRSR3.SA', 'ITSA4.SA') 1.13 5.00 5.19 0.37 -1.61%
('CPFE3.SA', 'CSRN3.SA') 0.90 5.50 8.44 0.26 -1.15%
('BMEB4.SA', 'ITSA4.SA') 0.46 1.40 2.10 0.17 -12.08%
('BAZA3.SA', 'BGIP4.SA') 0.40 3.14 0.83 0.19 -10.02%
('BMIN4.SA', 'SANB4.SA') 0.36 6.00 0.58 0.14 -13.62%
('BMIN4.SA', 'RPAD3.SA') 0.32 5.00 0.69 0.13 -12.59%
Room for improvements
Find best Hyperparameters
• Training period length
• Testing period length
• Stationarity check period length
Merge small sectors with fundamental relation
Other types of Statistical Arbitrage
• Index Arbitrage
• Option Arbitrage
Recommended References:
• Chan, Ernie. Algorithmic Trading (Wiley Trading). Wiley.
• Hilpisch, Yves. Python for Algorithmic Trading . O'Reilly Media.
Thank you!
Contact info:
luiz.guedes@occambrasil.com.br
https://www.linkedin.com/in/luizguedes/
Thank you!
Complete Webinar Recording

More Related Content

Similar to Pairs Trading In the Brazilian Stock Market

Presentation on Factors affecting Net Profit of ONGC
Presentation on Factors affecting Net Profit of ONGCPresentation on Factors affecting Net Profit of ONGC
Presentation on Factors affecting Net Profit of ONGCKaran Shah
 
Bayesian Dynamic Linear Models for Strategic Asset Allocation
Bayesian Dynamic Linear Models for Strategic Asset AllocationBayesian Dynamic Linear Models for Strategic Asset Allocation
Bayesian Dynamic Linear Models for Strategic Asset Allocationmax chen
 
Emperor Asset Management Investment Seminar.
Emperor Asset Management Investment Seminar. Emperor Asset Management Investment Seminar.
Emperor Asset Management Investment Seminar. Emperor Asset Management
 
Easter Trend Book RO
Easter Trend Book ROEaster Trend Book RO
Easter Trend Book ROHIPERCOM
 
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of July '18
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of July '18Flexible Equity Euro Long-Short (Market Neutral) strategy_End of July '18
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of July '18Giuseppe Piazzolla
 
Brioneja Probabilistic Decision Analysis For Elastomeric Components Sep 16,...
Brioneja   Probabilistic Decision Analysis For Elastomeric Components Sep 16,...Brioneja   Probabilistic Decision Analysis For Elastomeric Components Sep 16,...
Brioneja Probabilistic Decision Analysis For Elastomeric Components Sep 16,...Jose Briones
 
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of Oct. '17
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of Oct. '17Flexible Equity Euro Long-Short (Market Neutral) strategy_End of Oct. '17
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of Oct. '17Giuseppe Piazzolla
 
FRB Sales Page 1 of 30-1MM 1-3MM 3-5MM 5-10MM 10-25MM 25MM.docx
FRB Sales Page 1 of 30-1MM 1-3MM 3-5MM 5-10MM 10-25MM 25MM.docxFRB Sales Page 1 of 30-1MM 1-3MM 3-5MM 5-10MM 10-25MM 25MM.docx
FRB Sales Page 1 of 30-1MM 1-3MM 3-5MM 5-10MM 10-25MM 25MM.docxhanneloremccaffery
 
Analytics Value LLC 2017
Analytics Value LLC 2017Analytics Value LLC 2017
Analytics Value LLC 2017Wenfeng Chang
 
The Original Draft Copy of VaR and VaR Derivatives
The Original Draft Copy of VaR and VaR DerivativesThe Original Draft Copy of VaR and VaR Derivatives
The Original Draft Copy of VaR and VaR DerivativesRalph 刘冶民 Liu
 
Growing Money: Choosing Investments and Various Strategies
Growing Money: Choosing Investments and Various StrategiesGrowing Money: Choosing Investments and Various Strategies
Growing Money: Choosing Investments and Various StrategiesRavi Shikha
 
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of November '18
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of November '18Flexible Equity Euro Long-Short (Market Neutral) strategy_End of November '18
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of November '18Giuseppe Piazzolla
 
Advance iq capital quantitative models
Advance iq capital quantitative modelsAdvance iq capital quantitative models
Advance iq capital quantitative modelsAndrew214
 
How to apply CRM using data mining techniques.
How to apply CRM using data mining techniques.How to apply CRM using data mining techniques.
How to apply CRM using data mining techniques.customersforever
 
Security analysis and portfolio management
Security analysis and portfolio managementSecurity analysis and portfolio management
Security analysis and portfolio managementHimanshu Jain
 

Similar to Pairs Trading In the Brazilian Stock Market (20)

Presentation on Factors affecting Net Profit of ONGC
Presentation on Factors affecting Net Profit of ONGCPresentation on Factors affecting Net Profit of ONGC
Presentation on Factors affecting Net Profit of ONGC
 
Bayesian Dynamic Linear Models for Strategic Asset Allocation
Bayesian Dynamic Linear Models for Strategic Asset AllocationBayesian Dynamic Linear Models for Strategic Asset Allocation
Bayesian Dynamic Linear Models for Strategic Asset Allocation
 
Emperor Asset Management Investment Seminar.
Emperor Asset Management Investment Seminar. Emperor Asset Management Investment Seminar.
Emperor Asset Management Investment Seminar.
 
Summary jpx-wpenno2
Summary jpx-wpenno2Summary jpx-wpenno2
Summary jpx-wpenno2
 
Easter Trend Book RO
Easter Trend Book ROEaster Trend Book RO
Easter Trend Book RO
 
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of July '18
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of July '18Flexible Equity Euro Long-Short (Market Neutral) strategy_End of July '18
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of July '18
 
Brioneja Probabilistic Decision Analysis For Elastomeric Components Sep 16,...
Brioneja   Probabilistic Decision Analysis For Elastomeric Components Sep 16,...Brioneja   Probabilistic Decision Analysis For Elastomeric Components Sep 16,...
Brioneja Probabilistic Decision Analysis For Elastomeric Components Sep 16,...
 
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of Oct. '17
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of Oct. '17Flexible Equity Euro Long-Short (Market Neutral) strategy_End of Oct. '17
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of Oct. '17
 
FRB Sales Page 1 of 30-1MM 1-3MM 3-5MM 5-10MM 10-25MM 25MM.docx
FRB Sales Page 1 of 30-1MM 1-3MM 3-5MM 5-10MM 10-25MM 25MM.docxFRB Sales Page 1 of 30-1MM 1-3MM 3-5MM 5-10MM 10-25MM 25MM.docx
FRB Sales Page 1 of 30-1MM 1-3MM 3-5MM 5-10MM 10-25MM 25MM.docx
 
VaR analysis for Mutual funds
VaR  analysis for Mutual fundsVaR  analysis for Mutual funds
VaR analysis for Mutual funds
 
Analytics Value LLC 2017
Analytics Value LLC 2017Analytics Value LLC 2017
Analytics Value LLC 2017
 
The Original Draft Copy of VaR and VaR Derivatives
The Original Draft Copy of VaR and VaR DerivativesThe Original Draft Copy of VaR and VaR Derivatives
The Original Draft Copy of VaR and VaR Derivatives
 
Growing Money: Choosing Investments and Various Strategies
Growing Money: Choosing Investments and Various StrategiesGrowing Money: Choosing Investments and Various Strategies
Growing Money: Choosing Investments and Various Strategies
 
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of November '18
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of November '18Flexible Equity Euro Long-Short (Market Neutral) strategy_End of November '18
Flexible Equity Euro Long-Short (Market Neutral) strategy_End of November '18
 
Biodex
BiodexBiodex
Biodex
 
Advance IQ Capital Quantitative Models
Advance IQ Capital Quantitative ModelsAdvance IQ Capital Quantitative Models
Advance IQ Capital Quantitative Models
 
Advance iq capital quantitative models
Advance iq capital quantitative modelsAdvance iq capital quantitative models
Advance iq capital quantitative models
 
ch8.ppt
ch8.pptch8.ppt
ch8.ppt
 
How to apply CRM using data mining techniques.
How to apply CRM using data mining techniques.How to apply CRM using data mining techniques.
How to apply CRM using data mining techniques.
 
Security analysis and portfolio management
Security analysis and portfolio managementSecurity analysis and portfolio management
Security analysis and portfolio management
 

More from QuantInsti

ChatGPT and Machine Learning in Trading
ChatGPT and Machine Learning in TradingChatGPT and Machine Learning in Trading
ChatGPT and Machine Learning in TradingQuantInsti
 
Introduction to Quantitative Factor Investing
Introduction to Quantitative Factor InvestingIntroduction to Quantitative Factor Investing
Introduction to Quantitative Factor InvestingQuantInsti
 
Machine Learning for Options Trading
Machine Learning for Options TradingMachine Learning for Options Trading
Machine Learning for Options TradingQuantInsti
 
Portfolio Assets Allocation with Machine Learning
Portfolio Assets Allocation with Machine LearningPortfolio Assets Allocation with Machine Learning
Portfolio Assets Allocation with Machine LearningQuantInsti
 
Price Action Trading - An Introduction
Price Action Trading - An IntroductionPrice Action Trading - An Introduction
Price Action Trading - An IntroductionQuantInsti
 
Introduction to Systematic Options Trading
Introduction to Systematic Options TradingIntroduction to Systematic Options Trading
Introduction to Systematic Options TradingQuantInsti
 
Competitive Edges in Algorithmic Trading
Competitive Edges in Algorithmic TradingCompetitive Edges in Algorithmic Trading
Competitive Edges in Algorithmic TradingQuantInsti
 
Volatility Trading: Trading The Fear Index VIX
Volatility Trading: Trading The Fear Index VIXVolatility Trading: Trading The Fear Index VIX
Volatility Trading: Trading The Fear Index VIXQuantInsti
 
Big Data And The Future Of Retail Investing
Big Data And The Future Of Retail InvestingBig Data And The Future Of Retail Investing
Big Data And The Future Of Retail InvestingQuantInsti
 
Backtest of Short Straddles on SPX Index
Backtest of Short Straddles on SPX IndexBacktest of Short Straddles on SPX Index
Backtest of Short Straddles on SPX IndexQuantInsti
 
How To Set Up Automated Trading
How To Set Up Automated TradingHow To Set Up Automated Trading
How To Set Up Automated TradingQuantInsti
 
How To Set Up Automated Trading
How To Set Up Automated TradingHow To Set Up Automated Trading
How To Set Up Automated TradingQuantInsti
 
Quantitative Data Analysis of Cryptocurrencies
Quantitative Data Analysis of CryptocurrenciesQuantitative Data Analysis of Cryptocurrencies
Quantitative Data Analysis of CryptocurrenciesQuantInsti
 
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...QuantInsti
 
How to automate an options day trading strategy
How to automate an options day trading strategyHow to automate an options day trading strategy
How to automate an options day trading strategyQuantInsti
 
Predict daily stock prices with random forest classifier, technical indicator...
Predict daily stock prices with random forest classifier, technical indicator...Predict daily stock prices with random forest classifier, technical indicator...
Predict daily stock prices with random forest classifier, technical indicator...QuantInsti
 
How Pandemics Impact the Financial Markets - A Quantitative Analysis
How Pandemics Impact the Financial Markets - A Quantitative AnalysisHow Pandemics Impact the Financial Markets - A Quantitative Analysis
How Pandemics Impact the Financial Markets - A Quantitative AnalysisQuantInsti
 
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...QuantInsti
 
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...QuantInsti
 
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...QuantInsti
 

More from QuantInsti (20)

ChatGPT and Machine Learning in Trading
ChatGPT and Machine Learning in TradingChatGPT and Machine Learning in Trading
ChatGPT and Machine Learning in Trading
 
Introduction to Quantitative Factor Investing
Introduction to Quantitative Factor InvestingIntroduction to Quantitative Factor Investing
Introduction to Quantitative Factor Investing
 
Machine Learning for Options Trading
Machine Learning for Options TradingMachine Learning for Options Trading
Machine Learning for Options Trading
 
Portfolio Assets Allocation with Machine Learning
Portfolio Assets Allocation with Machine LearningPortfolio Assets Allocation with Machine Learning
Portfolio Assets Allocation with Machine Learning
 
Price Action Trading - An Introduction
Price Action Trading - An IntroductionPrice Action Trading - An Introduction
Price Action Trading - An Introduction
 
Introduction to Systematic Options Trading
Introduction to Systematic Options TradingIntroduction to Systematic Options Trading
Introduction to Systematic Options Trading
 
Competitive Edges in Algorithmic Trading
Competitive Edges in Algorithmic TradingCompetitive Edges in Algorithmic Trading
Competitive Edges in Algorithmic Trading
 
Volatility Trading: Trading The Fear Index VIX
Volatility Trading: Trading The Fear Index VIXVolatility Trading: Trading The Fear Index VIX
Volatility Trading: Trading The Fear Index VIX
 
Big Data And The Future Of Retail Investing
Big Data And The Future Of Retail InvestingBig Data And The Future Of Retail Investing
Big Data And The Future Of Retail Investing
 
Backtest of Short Straddles on SPX Index
Backtest of Short Straddles on SPX IndexBacktest of Short Straddles on SPX Index
Backtest of Short Straddles on SPX Index
 
How To Set Up Automated Trading
How To Set Up Automated TradingHow To Set Up Automated Trading
How To Set Up Automated Trading
 
How To Set Up Automated Trading
How To Set Up Automated TradingHow To Set Up Automated Trading
How To Set Up Automated Trading
 
Quantitative Data Analysis of Cryptocurrencies
Quantitative Data Analysis of CryptocurrenciesQuantitative Data Analysis of Cryptocurrencies
Quantitative Data Analysis of Cryptocurrencies
 
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
 
How to automate an options day trading strategy
How to automate an options day trading strategyHow to automate an options day trading strategy
How to automate an options day trading strategy
 
Predict daily stock prices with random forest classifier, technical indicator...
Predict daily stock prices with random forest classifier, technical indicator...Predict daily stock prices with random forest classifier, technical indicator...
Predict daily stock prices with random forest classifier, technical indicator...
 
How Pandemics Impact the Financial Markets - A Quantitative Analysis
How Pandemics Impact the Financial Markets - A Quantitative AnalysisHow Pandemics Impact the Financial Markets - A Quantitative Analysis
How Pandemics Impact the Financial Markets - A Quantitative Analysis
 
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
 
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
 
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
 

Recently uploaded

OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptxOAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptxhiddenlevers
 
Lundin Gold April 2024 Corporate Presentation v4.pdf
Lundin Gold April 2024 Corporate Presentation v4.pdfLundin Gold April 2024 Corporate Presentation v4.pdf
Lundin Gold April 2024 Corporate Presentation v4.pdfAdnet Communications
 
The Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfThe Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfGale Pooley
 
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptxFinTech Belgium
 
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...ssifa0344
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...shivangimorya083
 
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130Suhani Kapoor
 
How Automation is Driving Efficiency Through the Last Mile of Reporting
How Automation is Driving Efficiency Through the Last Mile of ReportingHow Automation is Driving Efficiency Through the Last Mile of Reporting
How Automation is Driving Efficiency Through the Last Mile of ReportingAggregage
 
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptxFinTech Belgium
 
20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdf20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdfAdnet Communications
 
Log your LOA pain with Pension Lab's brilliant campaign
Log your LOA pain with Pension Lab's brilliant campaignLog your LOA pain with Pension Lab's brilliant campaign
Log your LOA pain with Pension Lab's brilliant campaignHenry Tapper
 
03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptxFinTech Belgium
 
Dividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptxDividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptxanshikagoel52
 
00_Main ppt_MeetupDORA&CyberSecurity.pptx
00_Main ppt_MeetupDORA&CyberSecurity.pptx00_Main ppt_MeetupDORA&CyberSecurity.pptx
00_Main ppt_MeetupDORA&CyberSecurity.pptxFinTech Belgium
 
Instant Issue Debit Cards - High School Spirit
Instant Issue Debit Cards - High School SpiritInstant Issue Debit Cards - High School Spirit
Instant Issue Debit Cards - High School Spiritegoetzinger
 
The Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdfThe Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdfGale Pooley
 
The Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfThe Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfGale Pooley
 
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Recently uploaded (20)

OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptxOAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
 
Lundin Gold April 2024 Corporate Presentation v4.pdf
Lundin Gold April 2024 Corporate Presentation v4.pdfLundin Gold April 2024 Corporate Presentation v4.pdf
Lundin Gold April 2024 Corporate Presentation v4.pdf
 
The Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfThe Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdf
 
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
 
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
 
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
 
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
 
How Automation is Driving Efficiency Through the Last Mile of Reporting
How Automation is Driving Efficiency Through the Last Mile of ReportingHow Automation is Driving Efficiency Through the Last Mile of Reporting
How Automation is Driving Efficiency Through the Last Mile of Reporting
 
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
 
20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdf20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdf
 
Log your LOA pain with Pension Lab's brilliant campaign
Log your LOA pain with Pension Lab's brilliant campaignLog your LOA pain with Pension Lab's brilliant campaign
Log your LOA pain with Pension Lab's brilliant campaign
 
03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx
 
Dividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptxDividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptx
 
00_Main ppt_MeetupDORA&CyberSecurity.pptx
00_Main ppt_MeetupDORA&CyberSecurity.pptx00_Main ppt_MeetupDORA&CyberSecurity.pptx
00_Main ppt_MeetupDORA&CyberSecurity.pptx
 
Instant Issue Debit Cards - High School Spirit
Instant Issue Debit Cards - High School SpiritInstant Issue Debit Cards - High School Spirit
Instant Issue Debit Cards - High School Spirit
 
Veritas Interim Report 1 January–31 March 2024
Veritas Interim Report 1 January–31 March 2024Veritas Interim Report 1 January–31 March 2024
Veritas Interim Report 1 January–31 March 2024
 
The Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdfThe Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdf
 
The Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfThe Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdf
 
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

Pairs Trading In the Brazilian Stock Market

  • 1. Dr Luiz Guedes Occam Brasil Pairs Trading In the Brazilian Stock Market
  • 2. Statistical Arbitrage Concepts • Arbitrage: Trade operation free of risk • Statistical Arbitrage: Use of Statistics to find Trade operations (almost) free of risk • Pairs Trading: Statistical arbitrage model based on finding asset pairs that mutually (almost) neutralize each other’s risk. • Dollar neutral, Beta neutral, Alpha neutral,... • Cointegrated pair: Pair of assets that can be linearly combined to produce a stationary time series • Stationary time series: Time series with constant mean and variance
  • 3. Cointegrated Pairs BOVA11.SA - 0.956735 * BOVV11.SA ALUP4.SA - 0.5876 * CPLE3.SA
  • 4. Pairs Trading Backtest Algorithm 1. Identify Sectors and Tickers 2. For each Sector 1. Find cointegrating pairs for the training period 2. Get cointegrating pairs hedge ratio (Johansen test) 3. For each pair 1. Calculate pairs spread for the test period using training period hedge ratio 2. Run Bollinger Band Trading strategy for testing period 3. Save results Training Period Testing Train start Train end = Test start -1 Test end
  • 5. Backtest Process Training Period Testing Training Period Testing Training Period Testing Training Period Testing ... Training Period Testing Train start Train end = Test start -1 Test end x
  • 6. Pairs Trading Backtest Algorithm 1. Identify Sectors and Tickers 2. While period <= lastPeriod 1. For each Sector 1. Find cointegrating pairs for the training period 2. Get cointegrating pairs hedge ratio (Johansen test) 3. For each pair 1. Calculate pairs spread for the test period using training period hedge ratio 2. Run Bollinger Band Trading strategy for testing period 3. Save results 2. Advance to next period
  • 9. Bollinger Band Strategy with Stop Loss / Stop Time! Sell Close Buy Close Buy SL Exit!! Sell Close ST Exit!!
  • 10. Bollinger Band Trading JHSF3.SA - 1.3316 * MRVE3.SA
  • 11. Project BackTest Process Training Period Testing 2018-01-01 2020-04-30 2021-04-30 Training Period Testing 2009-01-01 2014-01-01 2014-12-31 Survivorship Bias!!!
  • 12. Brazil Stock Market Sectors with Size oil: 9 metal: 4 steel: 5 paper: 4 transp_material: 7 machines: 10 rail_roads: 3 highways: 3 storage: 2 services: 6 agriculture: 4 meat: 6 food: 4 construction: 25 fabric: 10 clothes_shoes: 14 education: 6 car_rental: 4 retail: 10 hospitals: 10 drugstores: 6 it: 11 telecom: 4 electricity: 37 water: 6 banking: 21 financial_services: 6 insurance: 8 real_estate: 16 Hindsight obs: Too many small sectors.
  • 13. Pairs per Sector #sectors x #pairs 1-Jan-2009 to 31-Dec-2014 1-Jan-2018 to 30-Apr-2021 All (sectors larger than 5) 10 x 750 15 x 1098 Cointegrated (signific > 90%) 10 x 393 15 x 442 Constant sign 10 x 333 14 x 361 Half-life <= 60 4 x 89 12 x 140
  • 14. Pairs per Sector – IBrX100 #sectors x #pairs All Top 100 All (sectors larger than 5) 15 x 1098 5 x 81 Cointegrated (signific > 90%) 15 x 442 5 x 21 Constant sign 14 x 361 4 x 18 Half-life <= 60 12 x 140 3 x 5
  • 15. Backtest results 2020-05-01 to 2021-05-01 - Top 100: Pair CAGR Hit Ratio Avg Profit/Loss Rets StdDev Max Draw-down ('ARZZ3.SA', 'HGTX3.SA') 1.23 2.60 2.33 0.37 -11.07% ('JHSF3.SA', 'MRVE3.SA') 0.72 4.33 0.80 0.19 -19.31% ('CMIG4.SA', 'CPFE3.SA') 0.58 3.00 1.46 0.20 -4.43% ('CPFE3.SA', 'ENBR3.SA') 0.36 2.00 1.44 0.13 -5.43% ('ENBR3.SA', 'TRPL4.SA') 0.10 1.00 1.35 0.08 -22.27% 2014-01-01 to 2015-01-01 - All Pair CAGR Hit Ratio Avg Profit/Loss Rets StdDev Max Draw-down ('CBEE3.SA', 'EKTR4.SA') 5.18 15.00 4.50 1.36 -2.94% ('BAZA3.SA', 'BNBR3.SA') 4.62 6.00 1.58 1.62 -12.25% ('BAZA3.SA', 'BMIN4.SA') 4.11 8.50 1.09 0.99 -17.30% ('CTSA4.SA', 'TXRX4.SA') 2.39 2.50 1.54 0.69 -45.70% ('BRSR3.SA', 'ITSA4.SA') 1.13 5.00 5.19 0.37 -1.61% ('CPFE3.SA', 'CSRN3.SA') 0.90 5.50 8.44 0.26 -1.15% ('BMEB4.SA', 'ITSA4.SA') 0.46 1.40 2.10 0.17 -12.08% ('BAZA3.SA', 'BGIP4.SA') 0.40 3.14 0.83 0.19 -10.02% ('BMIN4.SA', 'SANB4.SA') 0.36 6.00 0.58 0.14 -13.62% ('BMIN4.SA', 'RPAD3.SA') 0.32 5.00 0.69 0.13 -12.59%
  • 16. Room for improvements Find best Hyperparameters • Training period length • Testing period length • Stationarity check period length Merge small sectors with fundamental relation Other types of Statistical Arbitrage • Index Arbitrage • Option Arbitrage Recommended References: • Chan, Ernie. Algorithmic Trading (Wiley Trading). Wiley. • Hilpisch, Yves. Python for Algorithmic Trading . O'Reilly Media.