Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yahoo finance stock quote api

Tags:

json

yahoo-api

Is there any way to get historical stock prices from the yahoo api in the json format? I'd like to use REST because it's more lightweight.

like image 543
locoboy Avatar asked Dec 25 '10 03:12

locoboy


People also ask

Does Yahoo Finance have free API?

The Yahoo Finance API is a RESTful API that provides access to financial data. This data includes stock quotes, historical prices, and company information. The API is free to use and does not require an API key.

Does Yahoo Finance give real time quotes?

Yahoo Finance provides real-time streaming quotes for many exchanges. Real-time data is available during an exchange's market hours, and in some cases during pre-market and post-market hours. However, not all markets will stream in real-time.

Does Yahoo Finance allow scraping?

Does Yahoo Finance Allow Scraping. In short, yes. Most of the data available on the Yahoo Finance website is open-source and public information. This information consists of the following main parts.


1 Answers

To follow up on user586050's answer with a specific example...

You can use the YQL yahoo.finance.historical data table for this request, and have the results come back in JSON format.

For example try this query (the link will take you to the YQL console where you can play with it):

select * from yahoo.finance.historicaldata where symbol = "YHOO" and startDate = "2009-09-11" and endDate = "2009-09-15"

Sample results in JSON format:

{
 "query": {
  "count": 3,
  "created": "2011-12-31T19:44:20Z",
  "lang": "en-US",
  "results": {
   "quote": [
    {
     "date": "2009-09-15",
     "Date": "2009-09-15",
     "Open": "16.01",
     "High": "16.49",
     "Low": "15.87",
     "Close": "16.41",
     "Volume": "64668200",
     "Adj_Close": "16.41"
    },
    {
     "date": "2009-09-14",
     "Date": "2009-09-14",
     "Open": "15.45",
     "High": "15.58",
     "Low": "15.28",
     "Close": "15.57",
     "Volume": "19451200",
     "Adj_Close": "15.57"
    },
    {
     "date": "2009-09-11",
     "Date": "2009-09-11",
     "Open": "15.53",
     "High": "15.68",
     "Low": "15.41",
     "Close": "15.59",
     "Volume": "26860700",
     "Adj_Close": "15.59"
    }
   ]
  }
 }
}
like image 182
BrianC Avatar answered Sep 30 '22 07:09

BrianC