Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Yahoo Stock Quote Feed not working

Posted on 2010-09-16
4
Medium Priority
?
1,233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1000 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 84

Expert Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

618 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