Last active
September 24, 2016 22:38
-
-
Save shonnly/c5a04c1819d91c7882e2fd1b748848d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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