![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Problems with carret in URL (real time ticker sample) I have a ticker sample running with yahoo as provider. When it comes to indices they all start with a caret (^) like ^DJI. The framework converts this string internally into a %% before it is on the net (I saw it with wireshark) and than yahoo responds with a N/A ?? How can I get the framework to let the carret through?? here is the sample code: ?using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; namespace YahooTicker { class Program { private static void Main(string[] args) { string ticker = "^DJI"; Uri siteUri = new Uri("http://quote.yahoo.com/d/quotes.csv?s=" + ticker + "&f=sl1d1t1c1ohgvj1pp2owern&e=.csv"); WebClient web = new WebClient(); string data = web.DownloadString(siteUri); Quote q = Quote.Parse(data); Console.WriteLine(string.Format("{0} {1} Last:{2} Change:{3} Bid:{4} Offer: {5}", q.Ticker, q.Name, q.Last, q.Change, q.Bid, q.Offer)); Console.ReadLine(); } } public class Quote { public double Last { get; set; } public string Ticker { get; set; } public double Change { get; set; } public string Name { get; set; } public double Bid { get; set; } public double Offer { get; set; } public static Quote Parse(string data) { string[] fields = data.Replace("\"", "").Split(','); Quote q = new Quote { Ticker = fields[0].ToUpper(), Last = Convert.ToDouble(fields[1]), Change = Convert.ToDouble(fields[4]), Bid = Convert.ToDouble(fields[5]), Offer = Convert.ToDouble(fields[6]), Name = fields[7].ToUpper() }; return q; } } |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Problems with carret in URL (real time ticker sample) Mikeerh wrote: Quote: > I have a ticker sample running with yahoo as provider. > When it comes to indices they all start with a caret (^) like ^DJI. > The framework converts this string internally into a %% before it is > on the net (I saw it with wireshark) and than yahoo responds with a > N/A ?? How can I get the framework to let the carret through?? > > here is the sample code: Quote: > string ticker = "^DJI"; > Uri siteUri = new Uri("http://quote.yahoo.com/d/quotes.csv?s=" + ticker + > "&f=sl1d1t1c1ohgvj1pp2owern&e=.csv"); Andrew |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Script: change in real time the key in the registry | VB Script | |||
| C#.NET Interview Questions And Real Time Discussions | .NET General | |||
| Real-World Sample Application? | .NET General | |||
| Real time command line spy | PowerShell | |||
| How to turn on CA EZ Antivirus real-time? | Vista security | |||