Skip to content

Instantly share code, notes, and snippets.

@shonnly
Last active September 24, 2016 22:38
Show Gist options
  • Save shonnly/c5a04c1819d91c7882e2fd1b748848d0 to your computer and use it in GitHub Desktop.
Save shonnly/c5a04c1819d91c7882e2fd1b748848d0 to your computer and use it in GitHub Desktop.
using Newtonsoft.Json;
using System;
using System.Net;
using System.Xml;
namespace StockQuotePrinter
{
class Program
{
static void Main(string[] args)
{
var stockSymbols = new string[]{
"googl",
"msft",
"aapl",
"bbry",
"hpq"
};
foreach (var symbol in stockSymbols)
{
var client = new WebClient();
var response = client.DownloadString("http://dev.markitondemand.com/Api/v2/Quote?symbol=" + symbol);
var doc = new XmlDocument();
doc.LoadXml(response);
var name = doc.GetElementsByTagName("Name");
var price = doc.GetElementsByTagName("LastPrice");
Console.WriteLine($"{name[0].InnerText} - {price[0].InnerText}");
}
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment