• First you need to collect all stock symbols. I scraped http://eoddata.com/ and it served me very well. I scraped for NYSE and NASDAQ and feel free to download the two lists.
  • Next is to download historical price info from Yahoo:
    npm install yahoo-finance
    
    'use strict';
    
    var util = require('util');
    require('colors');
    var yahooFinance = require('yahoo-finance');
    
    var SYMBOL = 'AAPL';
    
    yahooFinance.historical({
      symbol: SYMBOL,
      from: '2012-01-01',
      to: '2012-12-31',
      // period: 'd'
    }, function (err, quotes, url, symbol) {
      if (err) { throw err; }
      console.log(util.format(
        '=== %s (%d) ===',
        symbol,
        quotes.length
      ).cyan);
      console.log(url.yellow);
      console.log(
        '%s\n...\n%s',
        JSON.stringify(quotes[0], null, 2),
        JSON.stringify(quotes[quotes.length - 1], null, 2)
      );
    });