node-yahoo-finance icon indicating copy to clipboard operation
node-yahoo-finance copied to clipboard

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

Open DIVYA-19 opened this issue 2 years ago • 2 comments

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);
    })

DIVYA-19 avatar Dec 27 '22 06:12 DIVYA-19

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
]

gadicc avatar Dec 29 '22 06:12 gadicc

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?

DIVYA-19 avatar Jan 02 '23 08:01 DIVYA-19