Stock Market (NIFTY) Forecasting Using Machine Learning Analysis On Option Chain
Stock Market (NIFTY) Forecasting Using Machine Learning Analysis On Option Chain
Stock Market (NIFTY) Forecasting Using Machine Learning Analysis On Option Chain
Published By:
Retrieval Number: 100.1/ijrte.E5155019521 Blue Eyes Intelligence Engineering
DOI:10.35940/ijrte.E5155.019521 80 and Sciences Publication
Stock Market (NIFTY) Forecasting using Machine Learning Analysis on Option Chain
PCR is a Contrarian indicator in the trading world and Table 2: Interpretation of Change in OI and LTP in Put
denotes the ratio of the total number of Put option contracts Contract.
and Call Option Contracts. Changes in the valueof Open
Interest(OI), Implied Volatility(IV), Last Traded Price(LTP) CHANGE
and Volume in respectof preceding Timestamp are also used CHANGE IN IN LAST
as features. The Strike Price where Open Interest is OPEN TRADED
Maxiumum for Call Option Contracts is considered as INTEREST(O PRICE(LT INTERPRETATIO PUT
‘Resistance’ for the underlying asset. At the same time, I) PUT P) PUT N SIGNAL
‘Support’ is the strike Price where Open Interest is BEARIS
RISE RISE LONG BUILDUP H
Maximum for Put Option Contracts. Depending upon the
BULLIS
signs of change in Open Interest and Last Traded Price we RISE FALL SHORT BUILDUP H
can also classify the Strike Price into one of the four SHORT BEARIS
Categories – Long BuildUp, Long Liquidation, Short FALL RISE COVERING H
BuildUp and Short Covering.[5]By observing the traded LONG BULLIS
Volume at different times of the day, we have found that FALL FALL LIQUIDATION H
significant trades.happen during the first and last two market A typical row in the dataset consists of Timestamp, Expiry
hours, so we have created a feature keeping that in mind. Date, PCR values, Interpretation of Change in Open Interest
and Change in Last Traded Price(LTP), the value of the
Table 1: Interpretation of Change in OI and LTP in Call underlying asset(NIFTY), time of the Trading day, Trading
Contract. Day(Monday, Tuesday, etc.) and data from ATM, Support
and Resistance Strike Prices.Since we are in the initial
stages of the research, we are not trying to predict the actual
CHANGE
values of the NIFTY, but we are attempting to at least
CHANGE IN LAST
IN OPEN TRADED
predict the trend of the NIFTY different time periods.The
INTEREST PRICE CALL research will help usfigure out if the data extracted from
CALL CALL INTERPRETATION SIGNAL Option Chain does have the power to predict and is worth
researching further.Over some time we have observed that
RISE RISE LONG BUILDUP BULLISH changes in the values of Option Chain are not readily
RISE FALL SHORT BUILDUP BEARISH reflected in the prices of NIFTY, so we conducted a series
SHORT of experimentsto see how the accuracy of the model changes
FALL RISE COVERING BULLISH with different time periods.
LONG
FALL FALL LIQUIDATION BEARISH
Published By:
Retrieval Number: 100.1/ijrte.E5155019521 Blue Eyes Intelligence Engineering
DOI:10.35940/ijrte.E5155.019521 81 and Sciences Publication
International Journal of Recent Technology and Engineering (IJRTE)
ISSN: 2277-3878, Volume-9 Issue-5, January 2021
Over some time we have observed that changes in the values Trading Tutorials and videos have always emphasized on
of Option Chain are not readily reflected in the pricesWe the use of Put Call Ratio(PCR) of Open Interest,and we do
formed a binary Target variable where it values 0 if the agree with this because PCR of Volume was our most
future value of NIFTY is less than the current value and 1 important feature.
otherwise. Since our target variable is binary and binary and However, surprisingly PCR of Open Interest does not
our data is numerical, we can use Classification Machine feature even in the top 15 ‘features’. Some other notable
Learning as well as Deep Learning Models. For this features include Open Interest values of the Put contract for
research, we have used CatBoost Classifier[6], which is fast, Resistance row and Call Contract’s for Support row. Implied
open-sourceand provides good results with relatively fewer Volatility(IV) does not feature anywhere in the top 15.
data. We have divided our data into two parts- 70% for
Training and 30% for Testing and a particular random state
IV. CONCLUSION
to get steady results. We have trained our model for 300
iterations with 100 early stopping rounds and used scikit- In the project, we researched the use of the Option chain
learn’s accuracy as well as ROC_AUC score as metrics for data to help predict the future trend of the underlying
our research. asset/NIFTY. Numerical results suggest high efficiency with
60% accuracy after 25 minutes and 70% accuracy after 30
III. RESULTS AND OBSERVATIONS minutes for the prediction of the NIFTY trend. PCR of
Volume was a prominent feature, but surprisingly PCR of
This research is based mostly on predicting trends (
Open Interest and Implied Volatility(IV) proved to be of
upward/downward) in NIFTY. We did not have pre hand little utility. Some noteworthy mentions include Open
knowledge about the time it takes for the changes in Option Interest values of the Put contract for Resistance and Call
chain to get reflected in the values of NIFTY. So we have Contract’s for Support. However, it is still far from what
tried multiple experiments in which we calculated the target could be used single-handedly in trading because knowing
variable using future values of NIFTY ranging from the the trend after 30 minutes might not give the confidence to
immediate row to next 6th row. As the timeframe or the time invest. Option Chain alone data may not be powerful
difference between each row is 5 minutes, this implies that enough. However, when coupled with the data of Equities,
we have tried predicting the trend of NIFTY using durations Futures and Sentiments and appropriate Deep Learning
ranging from 5 minutes to 30 minutes. Training scores were Technologies, it may become a game-changer.
always superior to testing scores, but both scores follow a
similar trend, where the scores dropped for the ‘Next 2nd REFERENCES
row’ (10 minutes in future) and then rising to their 1. https://www.investopedia.com/terms/o/option.asp
maximum in ‘Next 6th row’ (30 minutes in future) and 2. https://www.nseindia.com/option-chain
saturating at ‘Next 5th row.’ We also believed that by using 3. https://dotnettutorials.net/lesson/option-chain-analysis/
4. https://www.investopedia.com/trading/forecasting-market-direction-
preceding rows of data along with the current row might with-put-call-ratios/
produce some improvements in results. So we conducted 5. https://fyers.in/school-of-stocks/chapter/options/reading-option-chain-
experiments where up to 3 previous rows were used in using-volume-and-ol.html
6. https://catboost.ai/docs/concepts/python-
addition to the current row to predict the target variable. reference_catboostclassifier.html
However, this approach did not lead to any significant 7. Chia, C., 2020. Prediction Of Stock Price Movements Using Options
improvement in the result. Data., http://cs229.stanford.edu/proj2016spr/report/052.pdf
While understanding the ‘feature importance’ of the most
effective model, we encountered something interesting.
Table 3: Results of various Experiments
Published By:
Retrieval Number: 100.1/ijrte.E5155019521 Blue Eyes Intelligence Engineering
DOI:10.35940/ijrte.E5155.019521 82 and Sciences Publication
Stock Market (NIFTY) Forecasting using Machine Learning Analysis on Option Chain
NEXT
PREV1 0.9 0.61 0.9 0.6
ROW 3
NEXT
PREV1 0.94 0.63 0.94 0.63
ROW 4
NEXT
PREV1 0.94 0.66 0.94 0.65
ROW 5
NEXT
PREV1 0.94 0.7 0.94 0.69
ROW 6
NEXT
PREV1 + PREV2 0.65 0.56 0.64 0.56
ROW 1
NEXT
PREV1 + PREV2 0.81 0.56 0.8 0.55
ROW 2
NEXT
PREV1 + PREV2 0.87 0.58 0.87 0.57
ROW 3
NEXT
PREV1 + PREV2 0.93 0.64 0.93 0.63
ROW 4
NEXT
PREV1 + PREV2 0.94 0.66 0.94 0.65
ROW 5
NEXT
PREV1 + PREV2 0.94 0.69 0.94 0.69
ROW 6
NEXT PREV1 + PREV2 +
0.64 0.56 0.64 0.56
ROW 1 PREV3
NEXT PREV1 + PREV2 +
0.85 0.56 0.85 0.55
ROW 2 PREV3
NEXT PREV1 + PREV2 +
0.95 0.6 0.95 0.59
ROW 3 PREV3
NEXT PREV1 + PREV2 +
0.96 0.61 0.96 0.61
ROW 4 PREV3
NEXT PREV1 + PREV2 +
0.96 0.65 0.95 0.64
ROW 5 PREV3
NEXT PREV1 + PREV2 +
0.95 0.69 0.95 0.68
ROW 6 PREV3
AUTHORS PROFILE
Ritvik is a final year student in Computer Science
Dr Saurabh Gupta works asProfessor in and Engineering Department in Dr. Akhilesh Das
Computer Science and Engineering Department in Institute of Technology & Management affiliated
Dr. Akhilesh Das Institute of Technology & to GGSIPU, New Delhi. He is interested in puzzles
Management affiliated to GGSIPU, Delhi. of all kinds and cracking difficult logical scenarios
and also am an enthusiast in the world of machine
learning.
Published By:
Retrieval Number: 100.1/ijrte.E5155019521 Blue Eyes Intelligence Engineering
DOI:10.35940/ijrte.E5155.019521 83 and Sciences Publication