The URL I used for many years to download NSE bhavcopy into Excel is not working.
https://nsearchives.nseindia.com/content/historical/EQUITIES/2024/JUL/cm09JUL2024bhav.csv.zip
The URL I used for many years to download NSE bhavcopy into Excel is not working.
https://nsearchives.nseindia.com/content/historical/EQUITIES/2024/JUL/cm09JUL2024bhav.csv.zip
yeah it changed to this from today. Also internal column names and date format got changed.
https://nsearchives.nseindia.com/content/cm/BhavCopy_NSE_CM_0_0_0_20240708_F_0000.csv.zip
You can always check this by going to below and search for bhav
https://www.nseindia.com/all-reports
Thanks for the link.
Tried searching on that very NSE page before posting here but the file is labelled as âCM-UDIFFâ. Was not sure what that means. Turns out UDIFF is a reporting format.
yeah download the file and then you can copy the link from downloads page. So if it changes in future, we can get the new link. Maybe they are standardizing in some way, dunno.
Can you please share CD bhavcopy location also
You can download from here: https://www.nseindia.com/all-reports-derivatives
Select âCurrency Derivativesâ in drop-down.
Hey @SpacemanSpiff thanks for the prompt information, I was trying to fetch the new URL in google apps script but loading icon did not stopped rotating and it did not even generated a HTTP response code like 200 or 402, can you please help in this regard
No idea, i use my own tools and its working fine. You can try to hit the url manually from web browser to confirm.
Thanks for prompt reply, I can understand
Hi all,
Iâm trying to download NSE Bhavcopy files for dates before 1st Jan 2016 using Python. My function works perfectly for dates on or after 1st Jan 2016, but it fails for earlier ones even though Iâm able to download the same files manually via the browser.
When I use the Edge browserâs Downloads tab, I can get working download links for both pre- and post-2016 dates. The files for earlier dates download successfully through the browser, but not through my code.
Has anyone figured out why downloads before 1st Jan 2016 donât work via script, even though they work manually in the browser?
This link works for post 2016 dates
https://archives.nseindia.com/content/historical/EQUITIES/2016/JAN/cm01JAN2016bhav.csv.zip
Maybe the link is different, they have changed a few times in past.
So you will have to support all links. Just copy link from browser after download and check and code for that.
Even the csv format has changed and i had to code for both old and new.
For example, since a year or two - i use this. But this probably wont work for older files.
https://nsearchives.nseindia.com/content/cm/BhavCopy_NSE_CM_0_0_0_20240708_F_0000.csv.zip
Keep data saved so you donât have to download again.
How do you suggest i figure out the link pre-2016?
Download in browser, once file is downloaded you can copy the final link.
Then check if you can change date/filename to get other data for other days.
Also bhav copies have raw data so will have to adjust it based on splits, dividends and other stuff, is their any report or any resource available on NSE where i can look for the particular events that have happened to a stock ?
like how can i ?
Yeah, on nse bhavcopy page, search for âPRâ.
There is a file within that zip that has corporate actions.
It can have inconsistent formats, atleast in past data. Also not sure if its perfect, will need some kind of error detection which we can do atleast for major changes.
Its a bit of work, but should be good enough. I use it for alerts right now, but need to do some automated data extraction.
Donât know if any broker provides this data. Ideally stock data should be left unadjusted and this should be provided separately. Else it can become a mess if you dont download all data of a stock after any adjustment.
Bhavcopy is a good dataset from that pov. Plus should have dead stocks too.
i was trying to download PR files for dates before 2010 and i am unable to access it, didnt these PR files exist back then or were they stored in some other files ?, because i can adjust the pre-2010 data then
No idea, i have data since 2016. Tried it manually and NSE gives error from Jan 1 2010. So maybe it doesnât exist.
NSE website seems to have it from 2008, look at corp actions here
These guys maybe have since 2003, but will need to parse
Bse lists data from 2000 for SBI, but it seems to not match with above as we dont have any dividend in 2003
https://www.bseindia.com/corporates/corporates_act.html?scripcode=500112&scripname=State%20Bank%20of%20India
BSE should have bhavcopy too, so can check that but not all scrips will overlap.
Its unfortunate we donât get good meta data for this in a simple consistent format.
@siva - any chance zerodha can provide corporate action data separately with long history for all stocks ? Dunno who to tag
I completely agree. I also have data going back to January 1st, 2016. Without corporate events data, itâs unlikely that any backtest or analysis would be reliable. That said, if I do manage to access any of the earlier PR files, Iâll definitely let you know.
You mean corporate action adjusted data?
No, the corp action data itself.
If we store data locally, then any incremental backfill of data adjusted by Zerodha will not apply to saved data. Alternative is downloading all data with all history every time we update the db with new data, which is a bit too much.
Ideally, we should get data for dead stocks too to avoid bias. Bhavcopy has this, and has PR files for corp actions but from what i had seen, atleast in older data, they did not have a clear cut fixed format to parse. This is what i am going to use anyway as bhavcopy seems the best compromise but needs extra work and error checking and it will still not be perfect probably.
We also dont seem to have corp data earlier than 2010 in bhavcopy PR files.
In case, zerodha has already done this work then it would definitely reduce barriers for people to backtest overnight stocks.