1

Im trying to get historical data for Apple from google finance. but the start and end time is always the same.

in google-finance module sending a get request with these params to http://www.google.com/finance/historical should result in historical data between the dates but it returns last year instead.

var params = {    q: 'AAPL',
     startdate: '2014-01-01',
     enddate: '2014-12-31',
     output: 'csv'
  };

google-finance module example :

gFinance.historical({
  symbol: 'NASDAQ:AAPL',
  from: '2014-01-01',
  to: '2014-12-31'
}, function (err, quotes) {
   console.log(quotes);
});

result is always from today (8 oct 2017) to one year earlier(8 oct 2016):

 ...
 { date: 2017-02-22T20:30:00.000Z,
    open: 137.38,
    high: 137.48,
    low: 136.3,
    close: 136.53,
    volume: 20788186,
    symbol: 'NASDAQ:AAPL' },
  { date: 2017-02-23T20:30:00.000Z,
    open: 135.91,
    high: 136.66,
    low: 135.28,
    close: 136.66,
    volume: 21776585,
    symbol: 'NASDAQ:AAPL' },
  { date: 2017-02-26T20:30:00.000Z,
    open: 137.14,
    high: 137.44,
    low: 136.28,
    close: 136.93,
    volume: 20257426,
    symbol: 'NASDAQ:AAPL' },
  { date: 2017-02-27T20:30:00.000Z,
    open: 137.08,
    high: 137.44,
    low: 136.7,
    close: 136.99,
    volume: 23482860,
    symbol: 'NASDAQ:AAPL' },
  { date: 2017-02-28T20:30:00.000Z,
    open: 137.89,
    high: 140.15,
    low: 137.6,
    close: 139.79,
    volume: 36414585,
    symbol: 'NASDAQ:AAPL' },
  { date: 2017-03-01T20:30:00.000Z,
    open: 140,
    high: 140.28,
    low: 138.76,
    close: 138.96,
    volume: 26210984,
    symbol: 'NASDAQ:AAPL' },
  { date: 2017-03-02T20:30:00.000Z,
    open: 138.78,
    high: 139.83,
    low: 138.59,
    close: 139.78,
    volume: 21571121,
    symbol: 'NASDAQ:AAPL' },
  ... 151 more items ]

I dont know if they changed something or they closed it like yahoo did or Im doing something wrong. I searched for a week and everything seems outdated. how can I get historical data between custom times with http request?

Veto
  • 165
  • 1
  • 2
  • 7

1 Answers1

0

Gogle finance works as expected :

http://finance.google.com/finance/historical?q=AAPL&startdate=2014-01-01&enddate=2014-12-31&output=csv

You didn't put any source code.

user310291
  • 36,946
  • 82
  • 271
  • 487
  • i did. the `google-finance` module example is from npm. i just added the `console.log` to see quotes. it seems like the url is wrong in google-finance module. adding `finance` prefix solved the issue thanks – Veto Oct 08 '17 at 15:16