Solved

Yahoo Stock Quote Feed not working

Posted on 2010-09-16
4
1,175 Views
Last Modified: 2012-05-10
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
Comment
Question by:robertmayhue_iii
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 33694366
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
 

Author Comment

by:robertmayhue_iii
ID: 33695612
wow, that really stinks. Thanks you.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33696282
You know, I did answer your question.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now