I m doing a virtual stock trading project which requires me to get latest (or fairly recent / delayed) stock prices. I will be stimulating graphs using the prices etc. XML format would be prefered.
this works for me using asp.net
public string[] GetQuote(string symbol)
{
string strAll;
string[] strAllArray;
try
{
string fullpath=@"http://quote.yahoo.com/d/quotes.csv?s=" + symbol + "&f=snl1d1t1c1ohgv&e=.csv";
HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(fullpath);
HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse();
StreamReader strm = new StreamReader(webresp.GetResponseStream(),Encoding.ASCII);
strAll = strm.ReadLine();
strm.Close();
strAll = strAll.Replace( "\"", "" );
strAllArray = strAll.Split( new char[] {’,'} );
}
catch(Exception)
{
strAllArray = null;
}
return strAllArray;
}
January 1st, 2010 at 1:00 am
this works for me using asp.net
public string[] GetQuote(string symbol)
{
string strAll;
string[] strAllArray;
try
{
string fullpath=@"http://quote.yahoo.com/d/quotes.csv?s=" + symbol + "&f=snl1d1t1c1ohgv&e=.csv";
HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(fullpath);
HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse();
StreamReader strm = new StreamReader(webresp.GetResponseStream(),Encoding.ASCII);
strAll = strm.ReadLine();
strm.Close();
strAll = strAll.Replace( "\"", "" );
strAllArray = strAll.Split( new char[] {’,'} );
}
catch(Exception)
{
strAllArray = null;
}
return strAllArray;
}
References :
January 1st, 2010 at 1:30 am
give it to me
References :