Solved

Yahoo Stock Quote Feed not working

Posted on 2010-09-16
4
1,162 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 82

Accepted Solution

by:
Dave Baldwin earned 250 total points
Comment Utility
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
Comment Utility
wow, that really stinks. Thanks you.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
You know, I did answer your question.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

743 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

8 Experts available now in Live!

Get 1:1 Help Now