node-yahoo-finance2
node-yahoo-finance2 copied to clipboard
Validation error: Screener module
Validation Error
Minimal Reproduction
Simply do as mentioned in the screener docs.
import yahooFinance from 'yahoo-finance2';
const queryOptions = { scrIds: 'aggressive_small_caps', count: 5, region: 'US', lang: 'en-US' };
const result = await yahooFinance.screener(queryOptions);
Symbol(s) that it happened for
...
Error Message
"message": "Failed Yahoo Schema validation"
"stack": "<pre><span class="stack internal">at validate (/C:/Users/manas/dev/appname/node_modules/yahoo-finance2/dist/esm/src/lib/validateAndCoerceTypes.js:296:15)\n<span class="stack internal">at Object.moduleExec [as _moduleExec] (/C:/Users/manas/dev/appname/node_modules/yahoo-finance2/dist/esm/src/lib/moduleExec.js:87:9)\n<span class="stack internal">at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n<span class="stack">at fetchDaily (C:\Users\manas\dev\appname\server\api\stocks\movers\index.ts:13:1)\n<span class="stack">at
Environment
Browser or Node:
Node version (if applicable): 20+
Npm version: 10+
Browser version (if applicable): Edge
Library version (e.g. 1.10.1): 2.8.0
Additional Context
Note: Other modules are working fine.
BTW, I am using Nuxt3 app with Nitro server.
Refreshed a couple of times, and now it's working. Though it's a separate issue that adding region: 'IN' still returns USA data.
Do you know which field it failed on?
The error should show something like this:
{ "instancePath": "/quotes/0/quoteType",
"schemaPath": "#/definitions/SearchQuoteYahooEquity/properties/quoteType/const",
"keyword": "const",
"params": { "allowedValue": "EQUITY" },
"message": "must be equal to constant",
"data": "FUTURE"
And ya, changing region doesn't do anything, but Yahoo had it as a parameter so I kept it in there in case it does something later.
Hi! I have used example from docs and error does not show anything meaningfull:
FailedYahooValidationError: Failed Yahoo Schema validation at validate (/usr/local/lib/node_modules/yahoo-finance2/dist/cjs/src/lib/validateAndCoerceTypes.js:304:15) at Object.<anonymous> (/usr/local/lib/node_modules/yahoo-finance2/dist/cjs/src/lib/moduleExec.js:96:53) at Generator.next (<anonymous>) at fulfilled (/usr/local/lib/node_modules/yahoo-finance2/dist/cjs/src/lib/moduleExec.js:21:58) at processTicksAndRejections (node:internal/process/task_queues:95:5)
That is all what I see at the moment.