gadicc / node-yahoo-finance2

Unofficial API for Yahoo Finance
https://www.npmjs.com/package/yahoo-finance2
MIT License
353 stars 58 forks source link

stock avaialbe in yahoo but getting error through api #747

Closed ashwin31 closed 3 months ago

ashwin31 commented 3 months ago

https://finance.yahoo.com/quote/OCTAVIUSPL.BO/

code

const queryOptions = { period1: '2021-02-01', period2: '2021-02-10'};
const result = await yahooFinance.historical('OCTAVIUSPL.BO', queryOptions);
console.log(result)

error

https://query2.finance.yahoo.com/v7/finance/download/542938.BO?interval=1d&events=history&includeAdjustedClose=true&period1=1612137600&period2=1612915200
file:///home/ubuntu/workspace/node_modules/yahoo-finance2/dist/esm/src/lib/yahooFinanceFetch.js:110
        const error = new errors.HTTPError(response.statusText);
                      ^

HTTPError: Not Found
    at Object.yahooFinanceFetch [as _fetch] (file:///home/ubuntu/workspace/node_modules/yahoo-finance2/dist/esm/src/lib/yahooFinanceFetch.js:110:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.moduleExec [as _moduleExec] (file:///home/ubuntu/workspace/node_modules/yahoo-finance2/dist/esm/src/lib/moduleExec.js:52:18)
    at async file:///home/ubuntu/workspace/yf2.js:15:16 {
  code: 404
}

Node.js v20.11.1

but it is working for other stocks

ashwin31 commented 3 months ago

it looks like not having historical data. suggestion: it will be helpful to return some error message. closing this ticket.