pilwon / node-yahoo-finance

Yahoo Finance historical quotes and snapshot data downloader written in Node.js
495 stars 123 forks source link

If this happens consistently, Yahoo output has changed and you should open a bug report. #88

Open DIVYA-19 opened 1 year ago

DIVYA-19 commented 1 year ago

Getting this message on a get request If this happens consistently, Yahoo output has changed and you should open a bug report.

code

yahooFinance.historical({
      symbol: "AAPL",
      from: '2012-01-01',
      to: '2022-12-31'
    }, function (err, quotes) {
      console.log(quotes);
    })
gadicc commented 1 year ago

Hey @DIVYA-19, thanks for reporting.

Can you try with yahoo-finance2? (You'll need to read UPGRADING.md first).

This works for me (using yahoo-finance2):

$ yahoo-finance historical AAPL '{"period1":"2012-01-01","period2":"2022-12-31"}'
[
  {
    date: 2012-01-03T00:00:00.000Z,
    open: 14.621429,
    high: 14.732143,
    low: 14.607143,
    close: 14.686786,
    adjClose: 12.51928,
    volume: 302220800
  },
  // ... about 2700 results
]
DIVYA-19 commented 1 year ago

I am getting below error when I used yahoo-finance2 Uncaught (in promise) TypeError: URLSearchParams is not a constructor Any idea why I am seeing this error?