How it works
[Click to try it]
Yahoo Financials offers a pseudo-api that delivers market data and history in a CSV format when presented with a certain query string. (backlink
Yahoo sponsors an aggregator service called Yahoo DataTables. This service can be programmed in E4X (Ecmascript for Xml). With E4X, one can build a service that queries remote dataservices, aggregates the results, and delivers an XML response. I programmed this service to validate requested symbols, and then aggregate history and current data on them. (backlink
Yahoo offers a webservice-like query language named "Yahoo Query Language". It allows one to more easily query a Yahoo DataTable with a SQL-like syntax through an HTTP request. I programmed this service to connect to my Yahoo DataTable. (backlink
The application performs a CURL request, presenting a YQL request over HTTP.
The application caches the results for some period of time. From here forward, we essentially have a Model-View-ViewModel design.
The application presents the results in an XML-HTTP response to the page.
The ViewModel updates the graph of historical prices (highcharts.js) and the chart of current prices.
Subsequent requests are served from cache if possible. In general, symbol searches are cached for one month, history graphs for 1 day, and current prices for 15 minutes.
So, the data flow is:
Yahoo Financial API > Yahoo Datatables > Yahoo Query Language > PHP Server > Page > ViewModel > Highcharts Graph
Cache > PHP Server > Page > ViewModel > Highcharts Graph
Click to Run Unit Tests on the API