pair trading strategy example india
What is Pairs Trading?
Pairs trading strategy is a simple non-directional scheme. As the call suggests, you take offsetting mindful and short positions in a pair of extremely related stocks. This strategy is a not-directional strategy; it whole kit not only when there are big up-moves in the market but also any market conditions.
The idea is to obtain a pair of stocks that have a shrill correlation. We trade when the correlation between the two securities breaks. When one stock moves up patc the otherwise moves down, one would sell the outperforming stock and bribe the underperforming one. The stake is that the "spread" between the two would converge.
This blog wish effort to build a twosome trading scheme between the Indian indices, Nifty danamp; Depository financial institution Nifty. We first understand the maths behind pairs trading then show how to implement the strategy live using Quantinsti's Blueshift political platform.
Mathematics behind Pairs Trading
Patc the concept behind pairs trading is simple, the mathematics seat the pairs trading strategy is based on certain advanced statistical concepts like intend reversion and stationary stochastic processes.
We commence by looking at the correlation danamp; co-integration 'tween the two asset classes and so try out to mother a nonmoving relation that we can swop. We testament brush up on these concepts in the blog, but there are many a expedient resources to study the pairs trading strategy.
Dr. Ernest Chan, a stellar expert in AI and Amount Finance, explains pairs trading strategy simply and excitingly in " Stingy Reversion Strategies in Python " on an interactive learning platform, Quantra. In this run over, he describes various applied math methods to identify pairs in different instruments: equities, forex, commodities, among others.
Correlation coefficient danamp; Carbon monoxide gas-desegregation
We start off by correlation between the price information of the two indices.
As the charts show, the two serial publication are just about 80% correlated. But you not honourable want to deal the correlation merely also at a statistic called co-integration dannbsp;before you take a pairs switch. A Co-desegregation try is in use to establish a correlation between the time series in the long term.
A famous test for co-integration, the Engle-Granger method starts by creating residuals based on the static reversion so testing the residuals for unit-roots bearing. Information technology uses the Augmented Dickey-R. Buckminster Fuller Trial (ADF) Beaver State other tests to test stationarity in prison term series.
Stationarity danamp; Mean value Reversion
We used a acceptable cobalt-integration using statmodels in python and adage that the two series are CO-integrated. The incoming maltreat is to find the stationary relation based on which we can necessitate the pair trade.
A time serial is stationary if its intend and divergence are constant over time. Determination a stationary time series is critical to mock up mean reversion. Only with a unmoving march can you confidently say that the values will take back to their mean, and fluctuations around the imply will have around equal amplitudes.
If you look at the spread between the two time-series, just looking it, you can confidently say that it is not hateful-reverting or stationary.
We, therefore, now pauperism to process our two time-serial publication to a stationary relation based happening which we can trade. We find that patc the spread or the ratio of values is not stationary, the regression residuals between the ii time-series are stationary.
The plot below the regression residuals between the two time-series can be easily recognized As a stationary relation. The Augmented Dickey-Fuller test for stationarity also detects stationarity in the residuals.
Having detected this stationary sexual congress, we can with confidence say that if the residual goes above or below a convinced value, we can await it to turn back back to the mean.
Implementing the pairs trading scheme
We used the Quantra Blueshift dannbsp;platform to follow through the pairs trading strategy.
In the first-class course by Dr. Ernest Chan on Imply Reversion Strategies in Python , we check most mean throwback using demos, examples danamp; quizzes. We lavatory build mean reversion strategies while learning IT from experts with alive models on the platform itself!
The course enables one to learn to create these strategies and start live trading them connected the Quantra Blueshift dannbsp;platform.
The implementation is done victimisation the zipline API on the Blueshift platform. The initiative is creating the initialization function, which will delineate all the global variables. The set_commision and set_slippage functions are wont to set transaction cost to zero.
Then we define a function that will handle the inflowing data all atomic, as we are running and looking for for a pairs trading opportunity as oftentimes American Samoa possible.
Now, we last apply the good example and look at trading signal and how we wish place orders. For trading signal, we will buy the undervalued index and deal out the overvalued index when the cattle ranch calculated is supra 1.5 (positive or negative). We leave nonmeaningful our positions when the spread is below 0.5 (positive or negative). We will place orders on the weights dependent on trading signal and a constant. Looking at trading_signal and place_order python functions everything in the paragraph becomes clear.
Strategy Performance
Now is the time for the results. Our effectuation gave a fairly decent public presentation on the Quantra platform. We understand that the returns victimization a leverage of 3.5 are 59% in the 3 year period and the Sharpe Ratio is 2.28. The drawdown is also quite low at -3%
We can further improve our framework past playing with the variables defined during initialization. Eastern Samoa can be seen our results are auspicious to run along alive with. Pairs trading has always been seen equally a lucrative statistical arbitrage strategy.
Further Reading
Readers derriere watch this video on pairs trading away Quantra to know more active the pair trading strategy.If you are interested in theMean Reversion Strategies in Python course, you can email U.S. at info@wrightresearch.in to avail a special 15% discount specially for Wright Research subscribers
Investment in our pair trading scheme
Wright Research has late launched a simple dandy-Banknifty partner off trading scheme on Tradetron that users of tradetron can subscribe and trade hither: Pairs Trading away Wright Research
pair trading strategy example india
Source: https://www.wrightresearch.in/blog/pairs_trading
Posted by: corleyatrom1939.blogspot.com

0 Response to "pair trading strategy example india"
Post a Comment