Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleGoal

We're trying to print stock market price of Google, Apple and Yahoo using Yahoo finance apiMicrosoft using Yahoo finance API

0. Yahoo Query Language

Yahoo have a powerful query language that give us reasonable API to fetch data from verity of data table that their environment has like Yahoo weather or Yahoo finance.

to get more info and create or use queries visit https://developer.yahoo.com/yql/console/

1. API call to get stock market price for Google, Apple and Microsoft

if you call this query should get following result except the numbers and price may be different, for better view we removed the diagnostics section as we're not working with it 

Code Block
languagejs
{
	query: {
		count: 3,
		created: "2017-09-28T12:02:57Z",
		lang: "en-US",
		diagnostics: {},
		results: {
		quote: [
			{
				symbol: "AAPL",
				AverageDailyVolume: "26531500",
				Change: "+1.09",
				DaysLow: "153.54",
				DaysHigh: "154.72",
				YearLow: "104.08",
				YearHigh: "164.94",
				MarketCapitalization: "796.63B",
				LastTradePriceOnly: "154.23",
				DaysRange: "153.54 - 154.72",
				Name: "Apple Inc.",
				Symbol: "AAPL",
				Volume: "25504227",
				StockExchange: "NMS"
			},
			{
				symbol: "GOOG",
				AverageDailyVolume: "1521100",
				Change: "+19.63",
				DaysLow: "927.74",
				DaysHigh: "949.90",
				YearLow: "727.54",
				YearHigh: "988.25",
				MarketCapitalization: "654.42B",
				LastTradePriceOnly: "944.49",
				DaysRange: "927.74 - 949.90",
				Name: "Alphabet Inc.",
				Symbol: "GOOG",
				Volume: "2239441",
				StockExchange: "NMS"
			},
			{
				symbol: "MSFT",
				AverageDailyVolume: "21253800",
				Change: "+0.59",
				DaysLow: "73.17",
				DaysHigh: "74.17",
				YearLow: "56.32",
				YearHigh: "75.97",
				MarketCapitalization: "568.81B",
				LastTradePriceOnly: "73.85",
				DaysRange: "73.17 - 74.17",
				Name: "Microsoft Corporation",
				Symbol: "MSFT",
				Volume: "19565135",
				StockExchange: "NMS"
			}
			]
		}
	}
}