Download Historical Data from NSE in Excel VBA

#12
If you are not ready to help then please do not give an excuse.
ha ha ha

Bhai, your post holds no ground. I am not giving any excuse. I dont know how long you are here in TJ. I am here in TJ for last about 6 years and I know much more than you.

For data, I have helped and shared since long (even after being trolled by a bully, banned now), with my data with many members in the past and even now. Recently a member asked for data for 1 scrip, and when I asked for the name of the scrip, he gave me a list for 50 scrips. Isnt it funny, when one asks for a single scrip and then give you a list for 50 scrips. I was not ready for this much, so I simply denied.

I am always ready to help and share (what I want to share), and I believe in "neki kar dariya mein daal", but, certainly not ready to help/share after being trolled or abused or misbehaved. The taxation thread is a live example of this. And now I have stopped helping in that thread as well, after some rude incidents/experiences, trolling etc etc.

BTW, FYI, (none of you may be aware of it) I started a thread here on data sharing (still there), sometime back, where I shared data (that I have with me) with everyone for almost 1 year. And that thread has helped me in learning the mentality of many members. People want help and that too with showing attitude and without showing any gratitude. And I had to stop posting and sharing data there, only because of a member post.

And so now I have decided to share/help, what I want to share/help and not everything, that I know.
 

papa

New Member
#13
ha ha ha

Bhai, your post holds no ground. I am not giving any excuse. I dont know how long you are here in TJ. I am here in TJ for last about 6 years and I know much more than you.

For data, I have helped and shared since long (even after being trolled by a bully, banned now), with my data with many members in the past and even now. Recently a member asked for data for 1 scrip, and when I asked for the name of the scrip, he gave me a list for 50 scrips. Isnt it funny, when one asks for a single scrip and then give you a list for 50 scrips. I was not ready for this much, so I simply denied.

I am always ready to help and share (what I want to share), and I believe in "neki kar dariya mein daal", but, certainly not ready to help/share after being trolled or abused or misbehaved. The taxation thread is a live example of this. And now I have stopped helping in that thread as well, after some rude incidents/experiences, trolling etc etc.

BTW, FYI, (none of you may be aware of it) I started a thread here on data sharing (still there), sometime back, where I shared data (that I have with me) with everyone for almost 1 year. And that thread has helped me in learning the mentality of many members. People want help and that too with showing attitude and without showing any gratitude. And I had to stop posting and sharing data there, only because of a member post.

And so now I have decided to share/help, what I want to share/help and not everything, that I know.
You are here in TJ from last 6 years and you joined on Nov 2016. So you are using multiple Ids...:confused:
It seems you needs thanks in response to help whatever u had done earlier or u had not helped in the way that they wants......;)
 
#14
I prefer downloading the entire bhav copy in zip format. Here is the code that will download last 10 calendar days of bhav copies in zip format. You can change that number to go back in time as much as you want (365 for 1 year, 3650 for 10 years and so on). Note: The following code has been tested to work on macintosh. It may require small tweak with the trade_date to run on *nix or Cygwin on Windows.

Code:
#!/bin/bash
for (( i=1; i<=10; i++ ))
do
  echo $i
  trade_date=`date -r $((\`date +%s\` - i*86400)) '+%d%m%y'`
  echo trade_date=${trade_date}
  wget -nc --user-agent "Mozilla/5.0 (Windows NT 6.1)" --referer http://www.nseindia.com http://www.nseindia.com/archives/equities/bhavcopy/pr/PR${trade_date}.zip
done
 
#15
You are here in TJ from last 6 years and you joined on Nov 2016. So you are using multiple Ids...:confused:
It seems you needs thanks in response to help whatever u had done earlier or u had not helped in the way that they wants......;)
----------------------
 

mastermind007

Well-Known Member
#18
I prefer downloading the entire bhav copy in zip format. Here is the code that will download last 10 calendar days of bhav copies in zip format. You can change that number to go back in time as much as you want (365 for 1 year, 3650 for 10 years and so on). Note: The following code has been tested to work on macintosh. It may require small tweak with the trade_date to run on *nix or Cygwin on Windows.

Code:
#!/bin/bash
for (( i=1; i<=10; i++ ))
do
  echo $i
  trade_date=`date -r $((\`date +%s\` - i*86400)) '+%d%m%y'`
  echo trade_date=${trade_date}
  wget -nc --user-agent "Mozilla/5.0 (Windows NT 6.1)" --referer http://www.nseindia.com http://www.nseindia.com/archives/equities/bhavcopy/pr/PR${trade_date}.zip
done
curious trader
How do you throttle the speed ? NSE implements host of techniques to prevent downloading by bots such as these.
 
#19
curious trader
How do you throttle the speed ? NSE implements host of techniques to prevent downloading by bots such as these.
The bhav copy in zipped format has a size ~250-450KB. Downloading such a file once a day is no big deal. NSE doesn't allow download of such files without using the browser. Therefore I fake both the user-agent and referer to get around. In case you are downloading this data since 01-01-2010 since when NSE started publishing the bhav copy in zip format, this should take less than 5 mins. I download the zip file every day, unzip it and upload it in Amibroker. That way I have daily OHLC & Volume data for all NSE stocks & indices from 01-01-2010.
 
#20
Hi,

Thanks a lot for the code.

I am facing this unique problem with running the code. I get the output when I run the program in STEPPING in mode, but code fails to yield output when I run it via RUN button. I did all the permutation combinations I could to rectify it, but all in-vain. Will appreciate if you could help me, thanks in advance.