• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1258
  • Last Modified:

Yahoo Stock Quote Feed not working

I have a stock market feed on a webpage and it uses the Yahoo Finance csv file feeds via xml. For months it has been working fine. Recently the Dow Jones feed has been giving me a "subscript out of range error". In my code its the feed in the obj reference. The Nasdaq (obj2) and NYSE (obj6) feeds are fine. I even tried using the following link in the code for obj: http://finance.yahoo.com/d/quotes.csv?s=%5EDJI&f=sl1d1t1c1ohgv&e=.csv but I get an access denied error. Has Yahoo changed something or do I need to update the link in some way?
<%
Dim obj,obj2,obj6

Set obj = Server.CreateObject("MSXML2.XMLHTTP")
obj.Open "GET", "http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI&f=sl1d1t1c1ohgv&e=.csv", false
obj.Send
resp = obj.ResponseText
set obj = nothing

Set obj2 = Server.CreateObject("MSXML2.XMLHTTP")
obj2.Open "GET", "http://download.finance.yahoo.com/d/quotes.csv?f=sl9d1t1c1cohgvabjknpx&s=^IXIC", false
obj2.Send
resp2 = obj2.ResponseText
set obj2 = nothing

Set obj6 = Server.CreateObject("MSXML2.XMLHTTP")
obj6.Open "GET", "http://download.finance.yahoo.com/d/quotes.csv?f=sl9d1t1c1cohgvabjknpx&s=^NYA", false
obj6.Send
resp6 = obj6.ResponseText
set obj6 = nothing

dim lines,lines2,lines6 ' array for how many stocks
lines=split(resp,Chr(10))

lines2=split(resp2,Chr(10))

lines6=split(resp6,Chr(10))

contents = split(lines(i),",")  ' array for items in each line
contents2 = split(lines2(i),",")  ' array for items in each line
contents6 = split(lines6(i),",")  ' array for items in each line

sTemp=sTemp &"<Stock><Symbol>" &contents(0)&"</Symbol>"
sTemp=sTemp &"<Last>" &contents(1) &"</Last>"
sTemp=sTemp&"<Date>"&contents(2)&"</Date>"
sTemp=sTemp&"<Time>"&contents(3)&"</Time>"
sTemp=sTemp&"<Change>"&contents(4)&"</Change>"

%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table29">
								<tr>
									<td class="nextstepsheadercolor" background="../includes/images/backgrey2.gif" height="27" style="border-top: 1px solid #c8c8c8">
									<p align="left"><b><font size="2">&nbsp;</font>Current 
									Market Activity</b></td>

								</tr>
								<tr>
									<td class="nextstepsheadercolor">


<table border="0" width="180" cellspacing="0" id="table32">


	<tr>
		<td bgcolor="#F0F0F0" style="border:1px solid #C8C8C8; ">
		<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table33" style="border-left-width: 0px; border-right-width: 0px; border-top-width: 0px">
			
									
					
					
			<tr>
				<td style="border-bottom: 1px solid #C0C0C0; ; border-left-width:medium; border-right-width:medium; border-top-width:medium" width="54" align="center" height="19" bgcolor="#f8f4e9">
				<b><font size="1" face="Verdana">Index</font></b></td>
				<font face="Verdana">
				<td style="border-bottom: 1px solid #C0C0C0; ; border-right-width:medium; border-left-color:#C8C8C8; border-left-width:medium; border-top-color:#C8C8C8; border-top-width:medium" width="53" align="center" height="19" bgcolor="#f8f4e9">
				<font size="1" face="Verdana"><b>Last</b></font></td>
				<td style="border-bottom: 1px solid #C0C0C0; ; border-right-width:medium; border-left-color:#C8C8C8; border-left-width:medium; border-top-color:#C8C8C8; border-top-width:medium" width="53" align="center" height="19" bgcolor="#f8f4e9">
				<b><font size="1" face="Verdana">Change</font></b></td>
			</tr>
			<tr>
				<td style="border-bottom:1px solid #C0C0C0; border-right-width: medium; ; border-top-width:medium; " width="54" align="center" bgcolor="#FFFFFF" height="25">
				<font color="#000000" size="1"><font color="#000000">NASDAQ</font></font></td>
				<td style="border-bottom:1px solid #C0C0C0; border-left-width: medium; border-right-width: medium; ; border-top-width:medium; " width="53" align="center" bgcolor="#FFFFFF" height="25">
				<font size="1"><%= FormatNumber(Replace(contents2(1), chr(34), ""),2) %></font></td>
				<td style="border-bottom:1px solid #C0C0C0; border-left-width: medium; border-right-width: medium; ; border-top-width:medium; " width="53" align="center" bgcolor="#FFFFFF" height="25">
				<font size="1"><%= Replace(contents2(4), chr(34), "") %><% If Replace(contents2(4), chr(34), "") > 0 Then %>
					<img border="0" src="/webff/other/images/up.gif" width="10" height="14">
					<% Else %>
					<img border="0" src="/webff/other/images/down.gif" width="10" height="14">
					<% End If %>
</font>
</td>
			</tr>
			<tr>
				<td style="border-right-width: medium; border-top-width: medium; border-bottom: 1px solid #C8C8C8; ; border-left-color:#C8C8C8; border-right-color:#C8C8C8; border-top-color:#C8C8C8" width="54" align="center" bgcolor="#F0F0F0" height="25">
				<font color="#000000" face="Verdana" size="1">DJIA</font></td>
				<td style="border-left-width: medium; border-right-width: medium; border-top-width: medium; border-bottom: 1px solid #C8C8C8; ; border-left-color:#C8C8C8; border-right-color:#C8C8C8; border-top-color:#C8C8C8" width="53" align="center" bgcolor="#F0F0F0" height="25">
				<font size="1"><%= FormatNumber(Replace(contents(1), chr(34), ""),2) %></font></td>
				<td style="border-left-width: medium; border-right-width: medium; border-top-width: medium; border-bottom: 1px solid #C8C8C8; ; border-left-color:#C8C8C8; border-right-color:#C8C8C8; border-top-color:#C8C8C8" width="53" align="center" bgcolor="#F0F0F0" height="25">
				<font size="1"><%= Replace(contents(4), chr(34), "") %><% If Replace(contents(4), chr(34), "") > 0 Then %>
					<img border="0" src="/webff/other/images/up.gif" width="10" height="14">
					<% Else %>
					<img border="0" src="/webff/other/images/down.gif" width="10" height="14">
					<% End If %>
</font>
</td>
			</tr>
			<tr>
				<td style="border-bottom:1px solid #C0C0C0; border-right-width: medium; border-top-width: medium; ; " width="54" align="center" bgcolor="#FFFFFF" height="25">
				<font color="#000000" size="1">NYSE</font></td>
				<td style="border-bottom:1px solid #C0C0C0; border-left-width: medium; border-right-width: medium; border-top-width: medium; ; " width="53" align="center" bgcolor="#FFFFFF" height="25">
				<font size="1"><%= FormatNumber(Replace(contents6(1), chr(34), ""),2) %></font></td>
				<td style="border-bottom:1px solid #C0C0C0; border-left-width: medium; border-right-width: medium; border-top-width: medium; ; " width="53" align="center" bgcolor="#FFFFFF" height="25">
				<font size="1"><%= Replace(contents6(4), chr(34), "") %><% If Replace(contents6(4), chr(34), "") > 0 Then %>
					<img border="0" src="/webff/other/images/up.gif" width="10" height="14">
					<% Else %>
					<img border="0" src="/webff/other/images/down.gif" width="10" height="14">
					<% End If %>
</font>
</td>
			</tr>
			
	
					
					</tr><tr>
					<td colspan="3" height="35" width="163">
					<p align="center">
					<font size="1">Data as of <%= Replace(contents6(2), chr(34), "") %> at <%= Replace(contents6(3), chr(34), "") %><br />Minimum 20 minute delay</font></td></tr></table></td>
	</tr>
	
</table>

									</td>

								</tr>
								</table>
</body>

</html>

Open in new window

0
robertmayhue_iii
Asked:
robertmayhue_iii
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
Interesting you should ask that.  A friend just called me up and asked me to create a 'portfolio' and do the Excel download because the DJI was not showing up in his download.  He was right, it doesn't, he wasn't imagining things and it wasn't his computer.

And here's why: http://help.yahoo.com/l/us/yahoo/finance/known_issues/fitaki-13.html

"Because of new restrictions implemented by the Dow Jones Index, Yahoo! is no longer able to provide Dow Jones Index data for download in CSV format. We apologize for any inconvenience."
0
 
robertmayhue_iiiAuthor Commented:
wow, that really stinks. Thanks you.
0
 
Dave BaldwinFixer of ProblemsCommented:
You know, I did answer your question.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now