ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   nse website query (https://www.excelbanter.com/excel-programming/409255-nse-website-query.html)

Pradip Jain

nse website query
 
please see the following link

http://www.nseindia.com/content/equi...iphistdata.htm

the site generates historical data of price and volume based on various
inputs as follows: scrip code, start date and end date. suppose we choose
scrip code as ACC and start date as Jan 1, 2008 and end date as April 1,
2008. the site generates a file whose name is based on the inputs and can be
downloaded from the following url:

http://www.nseindia.com/content/equi...2008ACCEQN.csv

It is easy to write a code to generate the URL for a particular stock and
period for which data is required. for example i want to download ACC data
from Jan 1 2008 to March 1, 2008 the URL will be as under:

http://www.nseindia.com/content/equi...2008ACCEQN.csv

but the problem is if we try to staight away download this file, it is not
found on the server. reason is simple, the site generates the file based on
the query run. thus when "get results" button is pressed, the file is
generated. thereafter the above link will work and i can download the
required file.

now my query is can we write code to make the website run query based on
inputs entered in excel sheet and generate the file on the server and then
download the same


Don Guillett

nse website query
 
goto

and look in the files section. There are several free files.
I have a couple of free files under author donalb36

GetYahooMultipleHistoryALL_P

However, it uses USD

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pradip Jain" wrote in message
...
please see the following link

http://www.nseindia.com/content/equi...iphistdata.htm

the site generates historical data of price and volume based on various
inputs as follows: scrip code, start date and end date. suppose we choose
scrip code as ACC and start date as Jan 1, 2008 and end date as April 1,
2008. the site generates a file whose name is based on the inputs and can
be
downloaded from the following url:

http://www.nseindia.com/content/equi...2008ACCEQN.csv

It is easy to write a code to generate the URL for a particular stock and
period for which data is required. for example i want to download ACC data
from Jan 1 2008 to March 1, 2008 the URL will be as under:

http://www.nseindia.com/content/equi...2008ACCEQN.csv

but the problem is if we try to staight away download this file, it is not
found on the server. reason is simple, the site generates the file based
on
the query run. thus when "get results" button is pressed, the file is
generated. thereafter the above link will work and i can download the
required file.

now my query is can we write code to make the website run query based on
inputs entered in excel sheet and generate the file on the server and then
download the same



roger

nse website query
 
"Pradip Jain" wrote in message
...
please see the following link

http://www.nseindia.com/content/equi...iphistdata.htm

the site generates historical data of price and volume based on various
inputs as follows: scrip code, start date and end date. suppose we choose
scrip code as ACC and start date as Jan 1, 2008 and end date as April 1,
2008. the site generates a file whose name is based on the inputs and can

be
downloaded from the following url:


http://www.nseindia.com/content/equi...2008ACCEQN.csv


now my query is can we write code to make the website run query based on
inputs entered in excel sheet and generate the file on the server and then
download the same


You can download files if you set a reference to the
"Microsoft Internet Transfer Control"
(msinet.ocx)

Like this...

Sub getcsv()
Dim Inet1 As InetCtlsObjects.Inet
Dim s1 As String, s2 As String
Dim intfile As Integer

s1 = "inputtext=ACC&series=EQ&check=new&Fromday=1" _
& "&Frommon=1&Fromyr=2008&Today=1&Tomon=4&Toyr=2 008"

s2 = "112008142008ACCEQN.csv"

s1 = "http://www.nseindia.com/marketinfo/equities/" _
& "scripvol/histscrip.jsp?" & s1

Set Inet1 = New InetCtlsObjects.Inet
If InStr(Inet1.OpenURL(s1, icString), s2) 0 Then

s2 = "http://www.nseindia.com/content/equities/" _
& "scripvol/datafiles/" & s2

intfile = FreeFile
Open "c:\temp\test.txt" For Output As #intfile
Write #intfile, Inet1.OpenURL(s2, icString)
Close #intfile
End If
Set Inet1 = Nothing

End Sub

Also, Fiddler is very useful
http://msdn2.microsoft.com/en-us/lib...46(VS.85).aspx


--
roger





All times are GMT +1. The time now is 09:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com