IEOD -yahoo&google downloader vbscript

Einstein

Well-Known Member
#1
can anyone make necessary changes to this script and post it back here? it should work with both google and yahoo and let user download IEOD without any tool.


Set args = WScript.Arguments
filename = "D:\Main\Tools\VBdown\Exchanges\nyse.txt" '/ Change your ticker/symbol list here.

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso_OpenTextFile(filename)

Do Until f.AtEndOfStream
ticker = f.ReadLine
Url = "http://ichart.finance.yahoo.com/table.csv?s="&ticker&"&a=04&b=15&c=2014&d=04&e=29&f=2014&g=d&ignore=.csv" '/ change date here, format is MDY
'/ If yahoo made changes in future, you can simple change the url here and it will work just fine.
'/ Link http://finance.yahoo.com/q/hp?s=IBM&a=04&b=1&c=2014&d=04&e=15&f=2014&g=d

dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", Url, False
xHttp.Send
with bStrm
.type = 1 '//binary
.open
.write xHttp.responseBody
.savetofile "D:\Main\Tools\VBdown\nyseEOD\"&ticker&".csv" , 2 '//overwrite. Change Path here
end with
Loop
f.Close

'/by Einstein : 17 may 2014


Sample URL: https://finance.google.com/finance/getprices?q=HCLTECH&x=NSE&i=300&p=15d&f=d,c,o,h,l,v
 

LOVEENAJYOTHI

Well-Known Member
#2
can anyone make necessary changes to this script and post it back here? it should work with both google and yahoo and let user download IEOD without any tool.


Set args = WScript.Arguments
filename = "D:\Main\Tools\VBdown\Exchanges\nyse.txt" '/ Change your ticker/symbol list here.

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso_OpenTextFile(filename)

Do Until f.AtEndOfStream
ticker = f.ReadLine
Url = "http://ichart.finance.yahoo.com/table.csv?s="&ticker&"&a=04&b=15&c=2014&d=04&e=29&f=2014&g=d&ignore=.csv" '/ change date here, format is MDY
'/ If yahoo made changes in future, you can simple change the url here and it will work just fine.
'/ Link http://finance.yahoo.com/q/hp?s=IBM&a=04&b=1&c=2014&d=04&e=15&f=2014&g=d

dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", Url, False
xHttp.Send
with bStrm
.type = 1 '//binary
.open
.write xHttp.responseBody
.savetofile "D:\Main\Tools\VBdown\nyseEOD\"&ticker&".csv" , 2 '//overwrite. Change Path here
end with
Loop
f.Close

'/by Einstein : 17 may 2014


Sample URL: https://finance.google.com/finance/getprices?q=HCLTECH&x=NSE&i=300&p=15d&f=d,c,o,h,l,v
Request @rmike, he is a kind soul and has done something similar recently.
 

travi

Well-Known Member
#3
@Einstein You better move on to a couple of the newer utilities discussed in TJ for downloading IEOD from google.
There would be too much work involved in rewriting the above VbScript and no point in reinventing the wheel.

1. The deprecated Yahoo URL used to return a formatted csv file, google doesn't do that.
2. Goog uses epoch time format with interval, so raw data from the Google URL isn't compatible with AB, you need to convert the timestamps.
3. The timestamps further need to be converted to human-readable date, time format for AB.
 

Similar threads