Introducing ArbitrageLab Tear Sheets
by Valeriia Pervushyna
Join the Reading Group and Community: Stay up to date with the latest developments in Financial Machine Learning!
The many parts of pairs selection
Pairs selection is the first crucial step to building a pairs trading strategy. And it is no surprise, to perform it correctly, one must diligently examine, compare and contrast numerous test results, graphs and characteristics. For example, cointegration analysis alone can be performed in one of two methods – utilizing the Engle-Granger approach or the Johansen approach. To truly have the complete picture of the pairs suitability, with the Engle-Granger approach, the researcher should perform the test(and further analysis) for both possible combinations, A/B or B/A, in a pair since it is sensitive to which asset we choose to be the “dependent” one.
The Johansen test, in turn, provides multiple cointegration vectors, which also should be examined separately and taken into account. Not to mention the possible analysis of the residuals, auto-correlation tests, etc., brings even more data to the table for you to make your judgement.
LEARN MORE ABOUT PAIRS TRADING STRATEGIES WITH “THE DEFINITIVE GUIDE TO PAIRS TRADING”
And now, we have two options: memorize everything or constantly switch between numerous parameters and plots to check, contrast and compare. It results in loading your brain with tons of ‘noise’ that distracts from focusing on the evaluation itself. But it doesn’t have to be this way. Data analysis thrives when there is order, accessibility and clarity. And what embodies these three qualities better than combining everything into an interactive well-rounded tear sheet?
Introducing Arbitragelab TearSheets
Arbitragelab TearSheets is a new module created by the Hudson & Thames team that provides an interactive and effortless approach to pairs analysis.
It provides two comprehensive tear sheet types: Cointegration analysis and OU model analysis, based on the most popular ArbitrageLab modules functionality. All you need is just a dataframe of asset prices. The module creates a locally run Flask server that hosts your interactive tear sheet and allows you to interact with it freely inside your browser or inside of your Jupyter Notebook if you wish so.
Import the module, load your data, and run the server. The process is as easy as 1, 2, 3.
# Import the module from arbitragelab.tearsheet.tearsheet import TearSheet # Initialize the server tearsheet = TearSheet() server = tearsheet.ou_tearsheet(data) # Run the server server.run_server(port=8050)
Let’s dive a bit deeper into the mentioned tear sheets.
Cointegration tearsheet
Cointegration tear sheet includes:
- ADF test results and interpretation for each of the assets from the provided pair
- Normalized asset price series plot
- Engle-Granger cointegration test and further analysis for both asset combinations: A/B and B/A
- Portfolio coefficient
- Cointegration test results and interpretation
- The normalized portfolio price plot
- The normalized portfolio returns plot
- Model residuals analysis
- Statistical characteristics(std, half-life, skewness, kurtosis, normality test, etc.)
- Residuals plot
- ACF and PACF plots
- Q-Q plot
- Johansen cointegration test and further portfolio analysis for each of the two cointegrated vectors
- Cointegrated portfolio coefficients
- Cointegration test results for eigen cointegration test and interpretation
- Cointegration test results for trace cointegration test and interpretation
- Normalized portfolio price plot
- Normalized portfolio returns plot
OU model tearsheet
Cointegration tear sheet includes:
- Optimal mean-reverting portfolio coefficient and further fitted OU model analysis for both asset combinations: A/B and B/A
- Cointegration test results for the two assets and interpretation
- Normalized portfolio price plot
- Fitted OU process characteristics
- Spread price
- Simulated OU process with the same parameters
- A testing ground for the optimal stopping and liquidation levels calculation with changeable:
- Transaction costs
- Discount rate
- Stop-loss level