yahoo-finance-history

0.0.5 • Public • Published

yahoo-finance-history

Historical price history data from Yahoo Finance including dividends and splits

Install

$ npm install yahoo-finance-history --save

Usage

var yahoo = require("yahoo-finance-history");
global.fetch = require('node-fetch');
 
(async () => {
    try {
        let data = await yahoo.getPriceHistory("MSFT");
 
        // Raw history data returned by Yahoo Finance in CSV format
        const priceHistory = data.priceHistory;
        const dividendHistory = data.dividendHistory;
        const splitHistory = data.splitHistory;
 
        for (const price of priceHistory.split("\n").sort().reverse()) {
            console.log(price);
        }
 
        for (const dividend of dividendHistory.split("\n").sort().reverse()) {
            console.log(dividend);
        }
 
        for (const split of splitHistory.split("\n").sort().reverse()) {
            console.log(split);
        }
    }
    catch (ex) {
        console.log('got error:' + ex);
    }
})();

License

MIT license; see LICENSE.

Package Sidebar

Install

npm i yahoo-finance-history

Weekly Downloads

1

Version

0.0.5

License

MIT

Unpacked Size

5.79 kB

Total Files

4

Last publish

Collaborators

  • bitquant