0% found this document useful (0 votes)
27 views16 pages

SellerSetu Report

The report details a project on pair trading strategy and algorithm conducted by Sanat Ajay Gattani during an internship at Seller Setu Pvt. Ltd. The project aimed to develop a market-neutral trading strategy using statistical relationships between correlated stocks, which involved data collection, analysis, and backtesting to evaluate performance. Key findings indicated successful identification of mean-reverting stock pairs and the potential for low-risk returns, while also highlighting challenges in real-world application and recommendations for future enhancements.

Uploaded by

f20230946
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)
27 views16 pages

SellerSetu Report

The report details a project on pair trading strategy and algorithm conducted by Sanat Ajay Gattani during an internship at Seller Setu Pvt. Ltd. The project aimed to develop a market-neutral trading strategy using statistical relationships between correlated stocks, which involved data collection, analysis, and backtesting to evaluate performance. Key findings indicated successful identification of mean-reverting stock pairs and the potential for low-risk returns, while also highlighting challenges in real-world application and recommendations for future enhancements.

Uploaded by

f20230946
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

A REPORT

ON
PAIR TRADING STRATEGY AND ALGORITHM

BY
NAME OF THE STUDENT ID No
SANAT AJAY GATTANI 2023B3AD0946P

AT

Seller Setu Pvt. Ltd-Tech , Mumbai


A Practice School-I Station of

BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI


(June,2025)
A REPORT
ON
PAIR TRADING STRATEGY AND ALGORITHM
BY

Name of the Student [Link]. Discipline

Sanat Ajay Gattani 2023B3AD0946P Msc. Economics and


B.E Mathematics and
Computing

Prepared in partial fulfillment of the


Practice School-I Course Nos.
BITS C221/BITS C231/BITS C241

AT

Seller Setu Pvt. Ltd-Tech , Mumbai


A Practice School-I Station of

BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI


(June,2025)
ACKNOWLEDGEMENTS

I would like to express my heartfelt gratitude to all those who guided and
supported me during the course of my Practice School-I internship at
Sellersetu, an ONDC-based company.
First and foremost, I would like to thank [Link] Gupta and [Link]
Mehta, my industry mentors at Sellersetu, for providing me with invaluable
insights, constant encouragement, and an engaging project that challenged my
technical and analytical skills. Their mentorship has played a crucial role in the
successful completion of this project.
I am also deeply thankful to the team at Sellersetu for providing a collaborative
work environment and for sharing their expertise, which helped me better
understand the domain of digital commerce and financial strategy.
I extend my sincere thanks to [Link] Kumar Nagar, my PS-I faculty, for
their continuous academic support, timely feedback, and guidance throughout
this internship.
Finally, I would like to thank the Practice School Division of BITS Pilani for
providing me with this opportunity to gain hands-on industrial experience and
apply classroom knowledge in a real-world setting.

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE PILANI


(RAJASTHAN)
Practice School Division
Station: Seller Setu Pvt. Ltd Centre: Mumbai

Duration: 26th May-19th July,2025 Date of Start: 26th May,2025

Date of Submission: 22nd June,2025

Title of the Project: Pair Trading Strategy and Algorithm

ID No. 2023B3AD0946P
Name Sanat Ajay Gattani
Discipline of the student: Msc. Economics and B.E
Mathematics and Computing

Name(s) and designation(s) of Priyanshu Gupta (Co-Founder)


the expert(s): Pranav Mehta (Co-Founder)

Name(s) of the PS Faculty: [Link] Kumar Nagar

Key Words:
Cointegration,Correlation,ONDC,Algorithm,Backtest,Returns,Risk-Neutral

Project Areas:
Quantitative Finance, Algorithmic Trading,Financial Analytics
Abstract:
This project was carried out at Sellersetu, an ONDC-based company, as part
of the Practice School-I program. The objective was to explore a pair trading
strategy—a market-neutral approach that leverages statistical relationships
between two correlated stocks to generate trading signals.
Using historical price data, several stock pairs were analyzed for correlation
and cointegration. Selected pairs were used to build a trading model based
on z-score thresholds of their price spread. The strategy was then backtested
to assess performance under historical market conditions.
The project provided practical experience in financial data analysis and
quantitative trading, while contributing to Sellersetu’s efforts in financial
modeling and analytics.

Signature(s) of Student(s) Signature of PS Faculty


Date: 22nd June,2025 Date: 22nd June,2025
TABLE OF CONTENTS

Cover................................................................................................................................................. 1
Title Page .......................................................................................................................................... 2
ACKNOWLEDGEMENTS ...................................................................................................................... 3
Abstract Sheet ................................................................................................................................... 5
TABLE OF CONTENTS ......................................................................................................................... 6
INTRODUCTION ................................................................................................................................. 7
PROJECT: PAIR TRADING STRATEGY AND ALGORITHMS ...................................................................... 8
Background ................................................................................................................................... 8
Objective ....................................................................................................................................... 8
Methodology ................................................................................................................................. 9
Tools and Technologies ................................................................................................................ 10
Results and Insights ..................................................................................................................... 10
Challenges ................................................................................................................................... 11
Conclusions and Recommendations................................................................................................. 12
Conclusions ................................................................................................................................. 12
Recommendations ....................................................................................................................... 12
References....................................................................................................................................... 14
Glossary .......................................................................................................................................... 15
INTRODUCTION

The Practice School-I internship provides students with an opportunity to


integrate academic knowledge with industrial experience in real-world
environments. This report documents the work undertaken during the
internship at Sellersetu, an ONDC-based company engaged in enabling
digital commerce for businesses across India.
Sellersetu plays a key role in the ONDC ecosystem by offering technology
solutions to streamline seller onboarding, catalog management, and
transaction processing. The company is also exploring data-driven insights
and analytics to improve its operational efficiency and service quality.
As part of the internship, I was assigned a project titled “Design and
Implementation of a Statistical Pair Trading Strategy”, under the domain
of quantitative finance and data analytics. The project aimed to
investigate a market-neutral trading approach that involves identifying
pairs of correlated assets and capitalizing on temporary divergences in
their price relationship. The objective was to apply statistical techniques
to develop, test, and evaluate the performance of this strategy using
historical financial data.
My personal goal during the internship was to deepen my understanding
of financial markets, statistical modeling, and algorithmic trading systems.
I was responsible for end-to-end development of the trading strategy,
including data collection through APIs, preprocessing and filtering stock
pairs, implementing statistical tests like correlation and cointegration, and
coding the backtesting framework in Python. This experience allowed me
to apply theoretical knowledge from coursework to solve practical
problems and contribute meaningfully to Sellersetu’s ongoing exploration
of fintech-driven solutions.
The following sections of this report describe the background of the
project, methodology adopted, tools used, results obtained, challenges
encountered, and key learnings from the internship experience.

PROJECT: PAIR TRADING STRATEGY AND ALGORITHMS

Background
Pair trading is a market-neutral trading strategy that capitalizes on the temporary
divergence in the prices of two historically correlated financial instruments. Unlike
directional strategies that depend on market trends, pair trading assumes the
relationship between selected asset pairs is mean-reverting—i.e., their price spread
tends to return to a long-term average over time.
As part of the Practice School-I internship at Sellersetu, an ONDC-based e-commerce
platform, I undertook a project titled "Developing and Analyzing a Pair Trading
Strategy". The objective was to research and implement a fully rule-based
algorithmic trading strategy using quantitative methods and historical stock data.
This project aligns with Sellersetu’s broader fintech vision of leveraging data analytics
and automation for commercial insights and innovation.

Objective
The primary goals of the project were:
 To explore the theoretical and practical foundations of pair trading.
 To identify statistically cointegrated stock pairs within the NIFTY 50 universe.
 To design an automated strategy for entry and exit decisions based on spread
behavior.
 To backtest and evaluate the strategy’s profitability and risk under historical
data.
 To lay the groundwork for future real-time deployment and multi-asset
strategies.
Methodology
The project followed a structured approach, combining statistical analysis, algorithm
development, and backtesting. The steps were as follows:

Step 1: Data Collection


Historical daily closing prices of NIFTY 50 stocks were fetched using financial APIs. The
data spanned multiple years to allow for robust analysis and avoid short-term noise.

Step 2: Pair Selection


 Correlation filtering: Initial filtering was done using Pearson correlation to
shortlist pairs with strong co-movement.
 Cointegration testing: The shortlisted pairs were further tested using the
Engle-Granger method and the Augmented Dickey-Fuller (ADF) test. Only
those with a statistically significant (p < 0.05) cointegration relationship were
selected

Step 3: Strategy Development


 A spread was calculated between each pair using linear regression.
 The z-score of the spread was used to detect deviations from the mean.
 Trading logic:
o Enter trade when z-score > 1.5 or < -1.5
o Exit when z-score reverts to 0
o Stop-loss at z = ±3 (optional)
Step 4: Backtesting
 The strategy was simulated on historical data to evaluate its profitability, win
rate, and risk metrics.
 Key metrics included cumulative returns, Sharpe ratio, maximum drawdown,
and number of trades.

Tools and Technologies


The project was implemented using:
 Python: Core programming language
 Pandas, NumPy: Data processing and numerical analysis
 statsmodels: Statistical testing (ADF, regression)
 Matplotlib, Seaborn: Visualization of results
 Jupyter Notebook: Development and documentation platform
 Financial APIs: For fetching historical stock prices

Results and Insights


The backtesting process revealed that:
 Several stock pairs, such as HDFC–ICICI, TCS–Infosys, and Maruti–Tata Motors,
showed stable cointegration and mean-reverting spreads.
 The strategy delivered consistent and low-risk returns when parameters were
optimized.
 Results were sensitive to z-score thresholds and data window size, highlighting
the need for adaptive tuning.
 Net profit and returns changed significantly based on input parameters,
reinforcing the importance of strategy calibration.

Challenges
Some challenges encountered during the project included:
 Handling large datasets and filling missing or irregular values in stock data.
 Stationarity assumption failures for some pairs over longer timeframes,
leading to unreliable predictions.
 Computational time for testing a large number of stock combinations.
 False positives in statistical tests due to market noise or regime changes.
 Lack of real-world trading factors such as slippage, transaction costs, and
execution delays in the backtesting model.
Conclusions and Recommendations
Conclusions
This internship project at Sellersetu provided practical exposure to quantitative
finance and algorithmic strategy design, with a specific focus on pair trading. The
primary goal was to develop a statistically driven, market-neutral strategy using
historical stock price data from NIFTY 50 constituents.
Through systematic data collection, correlation analysis, cointegration testing, and
backtesting, the project successfully identified stock pairs that exhibited consistent
mean-reverting behavior. The trading logic based on z-score thresholds performed
reasonably well in simulation, achieving a respectable win rate (58%–65%) and
demonstrating stable returns with low drawdowns. These outcomes support the
premise that pair trading, when based on solid statistical foundations, can be a viable
low-risk strategy in equity markets.
The project also highlighted the need for careful handling of data, robust statistical
validation, and dynamic parameter tuning. It underscored the practical challenges of
transitioning a backtested model to a real-world environment where factors like
transaction costs, liquidity constraints, and execution latency must be accounted for.
Overall, the project contributed to Sellersetu's fintech exploration by laying the
groundwork for data-driven trading solutions and showcasing the relevance of
statistical arbitrage in modern digital finance.

Recommendations
Based on the insights gained during the project, the following recommendations are
proposed:
1. Live Market Integration:
o Extend the current backtesting framework to incorporate real-time
data feeds and simulate live market conditions.
o Integrate APIs from trading platforms for paper trading or automated
order execution.
2. Enhanced Risk Management:
o Implement dynamic stop-loss and position sizing techniques based on
volatility and drawdown analysis.
o Incorporate portfolio-level risk controls for multiple pair positions.
3. Machine Learning for Pair Selection:
o Explore the use of unsupervised learning (e.g., clustering, PCA) to
identify groups of similar stocks.
o Use regression-based or neural models to dynamically predict spread
behavior and entry signals.
4. Multi-Asset Expansion:
o Extend the strategy to include commodities, ETFs, or currency pairs,
enabling more diversification.
o Study inter-market relationships for cross-sector arbitrage.
5. Performance Monitoring Dashboard:
o Develop a dashboard to visualize key metrics, signals, and ongoing
trade performance.
o Include alert mechanisms for z-score triggers or strategy breakdowns.
6. Incorporation of ONDC-Linked Financial Assets (If Applicable):
o In the long term, explore the feasibility of applying similar strategies to
financial instruments tied to ONDC marketplaces, such as logistics
indices or digital payment activity metrics.

This project not only enhanced my technical and analytical abilities but also provided
valuable industry perspective on the challenges and possibilities of financial
innovation. I believe it adds practical value to Sellersetu’s ongoing work in fintech and
digital commerce analytics.
References
 [Link]
 [Link]
 [Link]
Glossary

Term Definition

Pair Trading A market-neutral strategy that involves taking


long and short positions in two historically
correlated assets, betting on mean reversion.

Market-Neutral A trading strategy that aims to generate returns


regardless of overall market direction by
balancing long and short positions.

Correlation A statistical measure (ranging from -1 to 1)


indicating the strength and direction of the
relationship between two asset prices.

Cointegration A statistical property of time series pairs where


their linear combination is stationary, indicating
a stable long-term relationship.

Mean Reversion The tendency of a stock's price spread to return


to its average over time after diverging.

Z-Score A standardized measure that shows how many


standard deviations a value is from the mean.
Used for identifying entry/exit signals.

Spread The difference between the prices (or adjusted


prices) of two stocks in a pair.

Backtesting A method of testing a trading strategy using


historical data to evaluate its potential
performance.

Sharpe Ratio A performance metric that measures return per


unit of risk; higher values indicate better risk-
adjusted returns.

Stationarity A condition where the statistical properties


(mean, variance) of a time series remain
constant over time.

Python A high-level programming language used for


data analysis, statistical modeling, and
algorithm development

statsmodels A Python library used for conducting statistical


tests and building linear models.
ONDC Open Network for Digital Commerce – a
government-backed initiative to democratize e-
commerce in India.

You might also like