What is the right way to backward adjust a stock's data after a split?

Hi,



I want to know what is the proper way to backward adjust a stock's price, volume and delivery volume after split has happened so that my machine learning model doesn't get wrongly trained.



you can see this if you download the data of AXISBANK from 1-1-2014 to 31-12-2015

the split happened on 28-7-2014.



How do I adjust the old data so that everything looks uniform? How do I handle volume?



AXISBANK's split happened from Rs 10 FV share to Rs 2 FV share



Divide OHLC by 5 and multiply volume with 5? is this the solution?



Kindly provide me with a code example if possible. Thank you.





 

Training and testing your model on adjusted OHLCV price is the only way.  And you have to retrain your model if any corporate action such as split, dividend, and bonus issue occurs. 



From your data vendor, you can get the adjustment factor or adjusted OHLCV values. But if you want to do it manually, then for the split, you can divide the price by the adjustment factor and multiply the volume by the adjustment factor from the record date. This will ensure that the rupee value traded on adjusted days is the same.



Thanks.



 

How do we manually incorporate corporate actions if we don't know the adjustment factor or we don't get the value from broker? Is there any detail from NSE ? That too when we have to do this for large number of stocks.

Hi Shreyas,



If you're unable to get the adjusted price data from your broker, you can obtain this information from various data vendors. A good starting point would be yfinance, which provides price data adjusted for corporate action like splits and dividends.



For a step-by-step guide on retrieving this data, you can refer to Section 2, Unit 10 of the free Quantra course Getting Market Data: Stocks, Crypto, News & Fundamentals, where this process is covered in detail.



Hope you find this helpful!



Thanks

Rushda