@gadicc is currently working on a fix to support the new API. Please follow PR #42 for the progress.PLEASE READ: This library is partially broken due to sudden API change by Yahoo Finance. The fantastic
The library handles fetching, parsing, and cleaning of CSV data and returns JSON result that is convenient and easy to work with. Both callback (last parameter) and promises (using Bluebird) styles are supported.
Also check out google-finance.
Important: New Yahoo API
Yahoo completely replaced their API on 2017-05-16. This interim release is intended to get you up and running again quickly, but we're still working on it. Note also that Yahoo stopped supporting their API for developers some time ago, so no guarantees can be made about service availability, but probably this package will keep working thanks to the magic of open-source. Regarding the package API:
historical()- should work as expected - please check the output and report any inconsistencies.
snapshot()- deprecated - returns the original format for SOME old options via a mapping layer. Since Yahoo's new API does not contain all the same data as the old version, 100% compatibility is impossible - but for the most common options, this should ease upgrade pains. When you can, transition to the new
quote()- NEW API more faithful to Yahoo's new API. See below. This replaces
snapshot()and we suggest you use it instead.
$ npm install --save yahoo-finance
var yahooFinance = ;yahooFinance;// This replaces the deprecated snapshot() APIyahooFinance;
See the full quote() docs for the list of all possible modules and the data they return.
See also the deprecated snapshot() API docs, for reference.
Download Historical Data (single symbol)
Download Historical Data (multiple symbols)
Specifying request options
Optionally request options (such as a proxy) can be specified by inserting an extra parameter just before the callback:
var httpRequestOptions =proxy: '';yahooFinance;yahooFinance;
See the contributors.
- Special thanks to @gadicc who brought the broken library back to life when Yahoo suddently changed their API. (check out his hero work at PR #37, #41, and #42)
The MIT License (MIT) Copyright (c) 2013-2017 Pilwon Huh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.