0% found this document useful (0 votes)
6 views

Draft_Paper

Uploaded by

f20201979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Draft_Paper

Uploaded by

f20201979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Exploiting Market Dynamics: Unveiling Above Normal Earnings

Through Algorithmic Pair Trading Strategy


Arham Chhajera , Aditya Sharmaa,∗ , Madhav Bohraa , Arya Kumara , Chandra Shekharb and
Vijender Yadavb
a Department of Economics and Finance, Birla Institute of Technology and Science Pilani, Pilani Campus, Pilani, 333031, Rajasthan, India
b Department of Mathematics, Birla Institute of Technology and Science Pilani, Pilani Campus, Pilani, 333031, Rajasthan, India

ARTICLE INFO ABSTRACT


Keywords: Passing equity short trade regulations, this study explores statistical arbitrage through pair trading
Statistical arbitrage using futures contracts. The prior two years’ learning period calculates earnings from real
Pair trading Indian equities market trades between 2020-23. The cointegration and distance-based methods
Market efficiency were used to select and build pairs and mark trade entrance and departure sites. The strategy
Co-integration was straightforward: exploit the short-term mispricing by relying on the long-term equilibrium
between the related stocks. In this strategy, entry and exit timing is important for maximizing
returns, requiring complicated monitoring and processing. Despite outperforming during the
downturn, the strategy was market-independent.

1. Introduction
Efficient Market Hypothesis (EMH) is the theoretical framework for market fluctuations and asset prices. The theory
is well recognized in financial literature and remains relevant for understanding asset price behavior. The investigation
has challenged the EMH by revealing anomalies in financial markets, especially in the short term (Sharma, Kumar
and Vaish, 2022). This study adopts the EMH premise of market efficiency but acknowledges its short-term failure
(Sharma and Kumar, 2019). The study incorporates the law of one price and examines financial market anomalies that
defy rational pricing and offer profit opportunities through active trading. Asset mispricing, particularly in emerging
markets like India, allows investors to exploit inefficiencies and deviations.
Statistics arbitrage-based pair trading is deceptively straightforward. Find similar assets with differential pricing
by analyzing stocks in the same industry or subsector associated but priced differently. Short the winner and buy the
loser as the spread widens. If EMH holds, arbitrageurs capitalize on price convergence (Aggarwal and Aggarwal, 2021;
Farago and Hjalmarsson, 2019). Pair trading’s success would highlight economic markets’ short-term inefficiencies.
The inefficiency may be caused by risk and arbitrage factors (Xiang and He, 2022) suggests that short-term investor
behavior can impact asset pricing and cause mispricing.
The study implements a pair trading strategy in Indian equity markets, uses futures to capitalize on short-term
mispricing, and earns gains above average market returns (Gupta and Chatterjee, 2020). Regulations on carrying
forward short positions beyond the trading day require futures contracts. Leveraged positions using futures contracts
reduced strategy implementation capital and increased percentage returns, especially in volatile markets. The study
investigates statistical arbitrage (pair trading) employing futures contracts instead of equities to capitalize on mispricing
in emerging equity markets like India. Based on the literature on pair trading strategies, this study is the first to
investigate a pair in the Indian equity market with futures contracts.

1.1. Data
Pair stocks were selected for their high correlations, stationarity, and liquidity. Yahoo Finance 2018–2020 share
price data was sorted sector-wise for the selected stocks. Next, stocks with futures and options (FnO) contracts were
filtered. The second filter was used because futures contracts were traded instead of stocks. Futures were employed for
∗ Correspondingauthor
[email protected] (A. Chhajer); [email protected] (A. Sharma);
[email protected] (M. Bohra); [email protected] (A. Kumar);
[email protected] (C. Shekhar); [email protected] (V. Yadav)
ORCID (s): 0000-0002-2114-9096 (C. Shekhar); 0009-0000-4188-7136 (V. Yadav)

Arham Chhajer et al.: Preprint submitted to Elsevier Page 1 of 7


Exploiting Market Dynamics

two distinct reasons. Instead of being restricted in Indian capital markets, short positions could be taken and carried
forward. Secondly, futures contracts implicitly ensure high liquidity for selected pairs, eliminating liquidity risk (Do
and Faff, 2012). Using futures contracts instead of stocks avoided zero-sum trades even after simultaneous long and
short positions since margins had to be paid on both. Increase the initial risk for selected pair trading. The margin
improved our profits multi-fold for all offers.
Only completed trades concluding before December 31, 2020, were considered in the final estimation, excluding
open trades. More straightforward trades started inside the year but not closed by this cutoff are excluded. We
implemented pairs trading in two stages. Two years of employment were spent on pair formation. We selected a
two-year formation time with a 2-SD threshold for the opening trigger, based on the study period of two working
years (Gatev, Goetzmann and Rouwenhorst, 2006).

1.2. Pairs Formation


The pair formation exercise was done using a custom-built Python algorithm. The code was run every day at
3 ∶ 30𝑝𝑚 IST after the close of trading. It helped to extract a list of 𝐹 𝑛𝑂 stocks and sort them sector-wise using a
Yahoo Finance API. Using the same code 𝐶! " pairs were formed within each sector. The pairs were then checked
for correlations and all the pairs with a correlation of 0.90 or below were filtered out reducing the prospective pairs
by almost 90%. The Augmented Dickey-Fuller test was implemented on the linear regression residuals to verify
cointegrated relationships within each pair. The above tests ensured strong comovement in the final pairs, optimizing
computing efficiency. Short and long positions were taken in the specified pairs’ futures contracts.

2. Methodology
Although many different strategies have been proposed to implement the pair trading arbitrage strategy (Law, Li
and Philip, 2018) the cointegration-based approach is straightforward and has beenproved useful and profitable by
multiple researchers (Farago and Hjalmarsson, 2019; Huang and Martin, 2019). The distance-based non-parametric
multivariate regressions have been used widely for measuring the association between variations in distance between
outcomes and predictor variables (Do and Faff, 2012; Gatev et al., 2006). The OLS-based regression was performed
to find the residuals which were then further used as inputs in performing the augmented Dickey-Fuller test for finding
the cointegrated relationship (Huang and Martin, 2019; Huck and Afawubo, 2015).
The regression equation used for cointegrating relationships is
𝑃1,𝑡 + 𝛽𝑃2,𝑡 = 𝜇 + 𝜉𝑡

Where, 𝑃1,𝑡 , and 𝑃2,𝑡 are the prices of paired stocks 1 and 2 at time 𝑡.
The 𝑃1,𝑡 and 𝑃2,𝑡 stocks were decided by minimizing the error ratio (Standard Error of the Intercept/ Standard
Error). The pairs were checked for stationarity and any pair with an ADF test value greater than 0.05 was excluded.
This helped in the identification of cointegrating relationships (Engle and Granger, 1987; Johansen, 1988). The thus
formed pairs enjoyed long-term equilibrium and pairs trading will attempt to take advantage of deviations from an
equilibrium asset-pricing framework with nonstationary standard components (Vidyamurthy, 2004; Lin, Chen and
Syu, 2021; Bogomolov, 2013) by calculating the deviations of 𝑃1,𝑡 + 𝛽𝑃2,𝑡 from its historical mean 𝜇.

3. Trading Strategy
Within the parameters, a total of 17 pairs were selected. The strategy was predicated on initiating long and short
trades when a pair’s price deviation surpasses two standard deviations (2-SD) from the mean, with positions being
closed as the residuals revert to the mean. If the value was found below i.e. -2SD, the strategy will be to take a long
position in Y‘s futures and a short position in X‘s futures (as the numerator stock is undervalued and the denominator
stock is overvalued). If it was above i.e. +2SD, the strategy will be to take a short position in Y‘s futures and a long
position in X‘s futures (since now the numerator stock is overvalued and the denominator stock is undervalued). To
mitigate any potential risks in the strategy, a stop-loss protocol was instituted at the value of the four standard deviation
(4SD) threshold based on the premise that deviations exceeding this limit may signify a fundamental shift in the stock’s
equilibrium not just a market anomaly that can be exploited using a statistical arbitrage trade. The trades were then
squared off only after mean reversion. That is, when the residuals came to 0 SD, the stop loss was hit. Apart from
that the trade was kept open without making any changes to it. Due to the use of futures contracts, only imperfect

Arham Chhajer et al.: Preprint submitted to Elsevier Page 2 of 7


Exploiting Market Dynamics

arbitrage was achieved but the effort was made to keep the difference between long and short positions to a minimum.
To further explain the positions, in one of the trades the short value was around 18 Lakh, and the long value was 6.5
Lakh. Therefore, in that case, the long position was taken in 3 lots and the short position in 1 Lot. This check was
written within the code as it first checked for the greater value trade and then multiplied the counterpart with 2 and
checked (Should be greater than 1.5 times else no change). If the trade value was still less it multiplied the counterpart
again but with 3 this time and checked. This was done until a difference of less than 1.5 times was achieved. One of
the trades (higher value one) was always kept fixed at 1 lot to keep a check on the total margin requirement.

4. Results
Table 1 below presents the test statistics used to select the stock pairs. This is a sample data showcasing 20 pairs
of which the top 10 pairs were selected as they passed the criteria (correlation > 0.90 and ADF p-value < 0.05) and
the bottom 10 pairs failed to meet both the criteria and were therefore rejected.
The duration of open positions was different for each trade and ranged from just a few days to even a few months.
On average the trades have taken 31 trading days to close. Almost 72% of the trades resulted in profit and the gain %
was above 100% in most of these. However, there was also a trade in which 100% margin was lost.
It was also observed that even during days of turmoil (the COVID-19 Saga) the strategy was highly profitable. Some
of the most profitable trades came around this time. This can also be of great value as the trader can protect their capital
and find undervalued stocks at the same time. Thus, it was evident that the strategy has significantly outperformed the
market as NIFTY returns were 14.9% but the strategy‘s returns were about 57%.
The majority of the stocks lost their cointegration before the pair crossed the 2nd standard deviation thus they
were avoided. But there were some pairs which were strongly cointegrated but suddenly seemed to have lost their
cointegration and continued to diverge. These were the losing trades. The worst trades through the years have been the
ones where the pairs diverge significantly losing their homoscedasticity and going through a fundamental shift. As a
result, the selected pair loses its cointegration and thus loses its tradability as a pair.
However, the best trades were the ones where stocks move together (maintaining the cointegrating relationship)
and diverge only slightly showing the market inefficiencies. The pair trades made use of these opportunities and traded
over the mispricing.
As an illustration of the pair trading strategy adopted in the study, Figure 1 showcases the best and the worst trade
taken during different years.
The best trade for the year 2020 was for the pair, Metropolis Healthcare (METROPOLIS.NS) and Dr. Lal PathLabs
(LALPATHLAB.NS). The chart tracks the normalized price paths of both stocks, reflecting their relative price change
over time. From the chart, it can be observed that the paired stocks were highly co-integrated and co-related over the
trading interval. The chart further indicates the points during the trading period when the stock prices diverge more
than two standard deviations thus marking the opportunity for taking trades and when the prices revert to the mean
marking the point for closing the positions. There were several openings and closings during the entire trading period
demonstrating the dynamic nature of pairs trading. The depicted payoffs were calculated based on one-dollar short and
long positions in the higher-priced stock and the lower-priced stock.
As reflected in the trade plots in Figure 1 above, selected pairs might open and close to take positions many times
during the trading period. Thus, providing multiple returns and making it challenging to arrive at the excess return
measure for a portfolio of pairs.
For the present study, a straightforward approach was adopted to calculate the total excess return. The initial margin
(SPAN margin) was considered as the capital for each trade. Subsequent trades are executed only if the margin balance
post the initial trade suffices to take new trades; otherwise, the new capital infusion was required and thus had to
be factored into the total capital deployed. Returns were calculated as the profit over the total capital deployed for
each stock, and this method was consistently employed across the entire portfolio. Then the net profits per pair were
computed at the year’s end (end of our trading period). All the profit was then summed up and divided by the total
margin employed for computing the net return.
No interest was considered for the margin as the interest paid for the long position was offset by the simultaneous
short position in the pair stock. Thus, there was no consideration of rollover cost either. Table 2 below summarizes the
trades during the trading year 2020.
As the study of pair trades was done over several years a separate record was maintained for each year marking it
as a single trading period. The following tables provide a summary of the pair trades taken from 2020 to 2023.

Arham Chhajer et al.: Preprint submitted to Elsevier Page 3 of 7


Exploiting Market Dynamics

Figure 1: Best and Worst Trades of 2020

Figure 2: Best and Worst Trades of 2021

Tables 4, 5, 6, and 7 provide sector-wise trade summaries for the years 2020 through 2023. Offering insights
into the performance of pair trading across different sectors over the four years, highlighting sectors with the highest
profitability and those with potential challenges. Each table presents the number of trades conducted, the number of
winning and losing trades, and the profit percentage for top 5 traded sectors of the year.
1. In 2020, the Finance Investment sector was most traded, but in all other years (2021-23) when the market
recovered computers-software was the most traded sector.
2. Automobiles has been the most profitable sector overall with more than 60% average return, followed by Finance
Investment with more than 32% average return.
3. Even though each year there were sectors with very high returns, there exists sectors that posted considerable
losses. The reason might be closing the trade positions within a trading year without actually waiting for the
convergence signal.

5. Conclusion
Pair trading is a strategy that can be implemented even with the use of futures contracts thus, circumventing the
regulatory restriction on short trading. In an emerging market like India, the strategy consistently surpassed the index
returns providing above 17% average return between 2020 and 2023. The strategy worked especially well giving very

Arham Chhajer et al.: Preprint submitted to Elsevier Page 4 of 7


Exploiting Market Dynamics

Figure 3: Best and Worst Trades of 2022

Figure 4: Best and Worst Trades of 2023

high returns, 36% annually, during the downward spiral in the year 2020. This means that the strategy is independent
of the market movements, with consistent excess returns during regular market conditions and very high returns during
market downturns. Though in total the trading strategy was profitable there still were large losses recorded in some
standalone trades putting the strategy in the high-risk category.

Credit authorship contribution statement


Arham Chhajer: Model Implementation. Aditya Sharma: Paper writing. Madhav Bohra: Methodology. Arya
Kumar: Proof read. Chandra Shekhar: Conceptualization of this study. Vijender Yadav: Editing, Analysis and Proof
read.

References
Aggarwal, G., Aggarwal, N., 2021. Risk-adjusted returns from statistical arbitrage opportunities in indian stock futures market. Asia-Pacific Financial
Markets 28, 79–99.
Bogomolov, T., 2013. Pairs trading based on statistical variability of the spread process. Quantitative Finance 13, 1411–1430.
Do, B., Faff, R., 2012. Are pairs trading profits robust to trading costs? Journal of Financial Research 35, 261–287.
Engle, R.F., Granger, C.W., 1987. Co-integration and error correction: representation, estimation, and testing. Econometrica: journal of the
Econometric Society , 251–276.

Arham Chhajer et al.: Preprint submitted to Elsevier Page 5 of 7


Exploiting Market Dynamics

Table 1
Summary Statistics for the Sample Pairs
Std_
𝑃1 𝑃2 ADF Results (P-value) Beta Intercept Variance Normalized_stdresidual residual Corr.

L&TFH.NS IDFC.NS 0.0123 2.94 2.7 10.8483 -0.664 -7.216 0.908


SBILIFE.NS HDFCAMC.NS 0.0000 4.50 -1234.6 164.8882 0.430 70.634 0.954
HDFCBANK.NS CUB.NS 0.0000 4.50 241.5 38.5707 -0.465 -17.860 0.927
SBILIFE.NS HDFCLIFE.NS 0.0009 1.50 11.9 45.2104 0.222 10.020 0.922
VEDL.NS HINDCOPPER.NS 0.0023 3.56 19.2 19.5226 -0.195 -3.820 0.943
MARUTI.NS EICHERMOT.NS 0.0028 2.38 2049.2 391.5431 -0.189 -74.110 0.937
SAIL.NS JINDALSTEL.NS 0.0043 2.55 26.1 16.1879 1.921 31.110 0.943
M&MFIN.NS L&TFH.NS 0.0044 1.29 88.0 13.2003 -2.619 -34.600 0.930
METROPOLIS.NS LALPATHLAB.NS 0.0048 1.34 -328.8 77.6889 -1.376 -106.070 0.925
HEROMOTOCO.NS ASHOKLEY.NS 0.0037 14.50 1474.7 193.1266 -0.942 -182.100 0.901
SRF.NS PIDILITIND.NS 0.0580 1.26 560.6 85.6553 -0.228 -19.490 0.815
GUJGASLTD.NS GSPL.NS 0.0599 1.10 -51.1 16.0886 2.397 38.500 0.757
IPCALAB.NS DIVISLAB.NS 0.0890 3.07 169.7 127.6640 -0.525 -66.780 0.871
MANAPPURAM.NS ICICIPRULI.NS 0.0920 1.79 180.9 34.0037 -0.482 -16.290 0.778
PETRONET.NS MCX.NS 0.0944 5.60 -498.2 70.8288 2.428 171.660 0.834
MANAPPURAM.NS ICICIGI.NS 0.0955 6.85 165.9 123.9026 -0.038 -4.780 0.792
LALPATHLAB.NS APOLLOHOSP.NS 0.0961 1.04 -223.6 126.9960 1.829 232.090 0.782
TCS.NS HCLTECH.NS 0.0980 5.02 -627.1 159.7613 -0.311 -49.590 0.745
BAJFINANCE.NS BAJAJFINSV.NS 0.1027 5.90 -1191.4 177.5640 -0.797 -141.100 0.971
MFSL.NS ABCAPITAL.NS 0.1049 1.10 321.1 32.7541 3.216 105.420 0.707

Table 2
Trading Summary for the Trading year 2020
𝑃1 𝑃2 Total Trades Taken Total Profit (000s) Total Trade Cost (000s) Returns (%) Margin Cost (000s) Returns (Margin)
HDFCBANK CUB 4 219 1656 13.3 353 62.2
HERO MOTOCORP ASHOKLEY 1 264 1488 17.7 346 76.2
ICICIGI BAJAJ FINANCE 2 59 1076 5.5 252 23.4
ICICI PRULIFE HDFCLIFE 3 216 1182 18.3 234 92.6
IDFC ABCAPITAL 2 100 554 18.0 184 54.1
KOTAK BANK HDFCBANK 2 92 1255 7.3 231 39.6
L&TFH IDFC 1 32 1024 3.1 172 18.5
M&MFIN L&TFH 2 60 2330 2.6 199 30.3
MARUTI EICHERMOT 3 122 1284 9.5 130 94.1
METROPOLIS LAL PATHLAB 5 323 1400 23.1 278 116.5
MUTHOOTFIN BAJAJ FINANCE 1 -198 898 -22.1 398 -49.8
MUTHOOTFIN ICICIGI 1 -172 795 -21.6 348 -49.4
SBILIFE HDFCAMC 2 128 1530 8.3 298 42.9
SBILIFE HDFCLIFE 1 74 989 7.5 173 43.0
VEDL HIND COPPER 2 22 450 5.0 152 14.8

Farago, A., Hjalmarsson, E., 2019. Stock price co-movement and the foundations of pairs trading. Journal of Financial and Quantitative Analysis
54, 629–665.
Gatev, E., Goetzmann, W.N., Rouwenhorst, K.G., 2006. Pairs trading: Performance of a relative-value arbitrage rule. The Review of Financial
Studies 19, 797–827.
Gupta, K., Chatterjee, N., 2020. Selecting stock pairs for pairs trading while incorporating lead–lag relationship. Physica A: Statistical Mechanics
and its Applications 551, 124103.
Huang, Z., Martin, F., 2019. Pairs trading strategies in a cointegration framework: back-tested on cfd and optimized by profit factor. Applied
Economics 51, 2436–2452.
Huck, N., Afawubo, K., 2015. Pairs trading and selection methods: is cointegration superior? Applied Economics 47, 599–613.
Johansen, S., 1988. Statistical analysis of cointegration vectors. Journal of economic dynamics and control 12, 231–254.

Arham Chhajer et al.: Preprint submitted to Elsevier Page 6 of 7


Exploiting Market Dynamics

Table 3
Year wise Trade Summary

2020 2021 2022 2023


Trades 32 30 72 26
Winning 24 16 56 20
Losing 6 14 16 6
Total 3,748 4,888 15,436 4,372
Investment
(INR 000s)
Total 1,342 167 2,308 762
Return
(INR 000s)
Profit (%) 36 3.5 15 17
BEST PAIR METROPOLIS_ TATAMOTORS_ TATACOMM_ HDFCLIFE_
LALPATH LAB ASHOKLEY HCLTECH HDF-
CAMC
WORST MUTHOOTFIN_ PNB_CANBK DALBHARAT_ MPHASIS_
PAIR ICICIGI AMBU- BSOFT
JACEM

Table 4
Sectorwise Trades 2020
Sector Pairs Selected # of Trades Winning Trades Losing Trades Profit (%)
Finance Investment 9 12 9 3 13
Banks - Private Sector 2 6 4 2 40
Automobiles 2 4 4 0 81
Healthcare 1 5 4 1 116
Mining / Minerals / Metals 1 2 1 1 15

Table 5
Sectorwise Trades 2021
Sector Pairs Selected # of Trades Winning Trades Losing Trades Profit (%)
Computers - Software 7 15 10 5 -62
Banks - Private Sector 5 6 5 1 26
Chemicals 3 4 1 3 -26
Auto Ancillaries 1 1 1 0 68
Automobiles 1 5 4 1 135

Law, K., Li, W.K., Philip, L., 2018. A single-stage approach for cointegration-based pairs trading. Finance Research Letters 26, 177–184.
Lin, T.Y., Chen, C.W., Syu, F.Y., 2021. Multi-asset pair-trading strategy: A statistical learning approach. The North American Journal of Economics
and Finance 55, 101295.
Sharma, A., Kumar, A., 2019. A review paper on behavioral finance: study of emerging trends. Qualitative research in financial markets 12, 137–157.
Sharma, A., Kumar, A., Vaish, A.K., 2022. Market anomalies and investor behaviour. Afro-Asian Journal of Finance and Accounting 12, 62–81.
Vidyamurthy, G., 2004. Pairs Trading: quantitative methods and analysis. volume 217. John Wiley & Sons.
Xiang, Y., He, J., 2022. Pairs trading and asset pricing. Pacific-Basin Finance Journal 72, 101713.

Arham Chhajer et al.: Preprint submitted to Elsevier Page 7 of 7


Exploiting Market Dynamics

Table 6
Sectorwise Trades 2022
Sector Pairs Selected # of Trades Winning Trades Losing Trades Profit (%)
Computers - Software 10 15 13 2 27
Cement 6 7 3 4 -10
Chemicals 5 9 8 1 27
Finance Investment 5 10 7 3 38
Pharmaceuticals 4 4 3 1 12

Table 7
Sectorwise Trades 2023
Sector Pairs Selected # of Trades Winning Trades Losing Trades Profit (%)
Computers - Software 5 5 2 3 0
Finance Investment 3 7 7 0 77
Cement 2 4 2 2 9
Automobiles 1 2 2 0 27
Banks - Public Sector 1 2 1 1 -28

Arham Chhajer et al.: Preprint submitted to Elsevier Page 8 of 7

You might also like