Pairs Trading Machine
Project Description
The project can be found on my GitHub!
​
Pairs trading is a statistical arbitrage technique used in quantitative finance. Unlike traditional research-based trading techniques, statistical arbitrage is model-based where the buying and selling of assets is entirely automated and dependent on the mathematical relationships between certain prices in the market.
​
The pairs trading machine is part of a larger project to evaluate the pairs trading algorithm and optimize its parameters using modern stock data. Coded entirely in python, the machine allows the user to customize, edit, and reprogram the parameters and assumptions of the standard pairs trading model. Given a table of daily stock price data over a period of time, the machine will run the custom model and produce the trading actions and returns over the specified time period.
Methods
-
Built a pairs trading application from scratch in Python for research on statistical arbitrage
-
Used data manipulation methods in pandas and numpy to format 2,520,000 data points from S&P500 daily stock prices over 20 years as readable input for the machine
-
Efficiently and intelligently formulated stock pairs using k-NN machine learning algorithm in sklearn
-
Designed the backtesting and evaluation algorithm with high runtime efficiency
-
Conducted optimization on pairs trading parameters and methods using the machine to generate a significant increase in model returns over existing literature