yql / yql-tables

YQL is extensible using a table definition. This repository will hold community contributed definitions.
http://developer.yahoo.com/yql
724 stars 416 forks source link

fix finance.historicaldata to return symbol #405

Closed mfisher87 closed 10 years ago

mfisher87 commented 10 years ago

Instead of returning the date twice in the response struct, replace first date element with symbol. This adds support for YQL "symbol IN (a,b,c)" functionality.

mfisher87 commented 10 years ago

Allows users to grab historical data for multiple symbols in one call. To accomplish the below query, I no longer need 3 calls, one for each symbol.

Query: select * from yahoo.finance.historicaldata where symbol in ('GOOG','YHOO','MSFT') and startDate = "2010-03-09" and endDate = "2010-03-09"

Old response: { "date": "2010-03-09", "Date": "2010-03-09", "Open": "559.85", "High": "564.66", "Low": "556.50", "Close": "560.19", "Volume": "3176600", "Adj_Close": "560.19" }, { "date": "2010-03-09", "Date": "2010-03-09", "Open": "16.41", "High": "16.72", "Low": "16.40", "Close": "16.53", "Volume": "20755200", "Adj_Close": "16.53" }, { "date": "2010-03-09", "Date": "2010-03-09", "Open": "28.56", "High": "29.11", "Low": "28.55", "Close": "28.80", "Volume": "50271600", "Adj_Close": "26.26" }

New response: { "Symbol": "GOOG", "Date": "2010-03-09", "Open": "559.85", "High": "564.66", "Low": "556.50", "Close": "560.19", "Volume": "3176600", "Adj_Close": "560.19" }, { "Symbol": "YHOO", "Date": "2010-03-09", "Open": "16.41", "High": "16.72", "Low": "16.40", "Close": "16.53", "Volume": "20755200", "Adj_Close": "16.53" }, { "Symbol": "MSFT", "Date": "2010-03-09", "Open": "28.56", "High": "29.11", "Low": "28.55", "Close": "28.80", "Volume": "50271600", "Adj_Close": "26.26" }