ChartResultObject
Validation Error
Minimal Reproduction
await yahooFinance.quote('XAU')
Symbol(s) that it happened for
- XAU
Error Message
{
"type": 45,
"schema": {
"title": "YahooNumber",
"anyOf": [
{
"title": "RawNumber",
"type": "object",
"properties": {
"raw": {
"type": "number"
}
},
"required": [
"raw"
]
},
{
"type": "number"
}
]
},
"path": "/meta/regularMarketPrice",
"message": "Expected required property"
}
This may happen intermittently and you should catch errors appropriately.
However: 1) if this recently started happening on every request for a symbol
that used to work, Yahoo may have changed their API. 2) If this happens on
every request for a symbol you've never used before, but not for other
symbols, you've found an edge-case (OR, we may just be protecting you from
"bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side).
Please see if anyone has reported this previously:
https://github.com/gadicc/node-yahoo-finance2/issues?q=is%3Aissue+ChartResultObject
or open a new issue (and mention the symbol): yahoo-finance2 v2.13.3
https://github.com/gadicc/node-yahoo-finance2/issues/new?labels=bug%2C+validation&template=validation.md&title=ChartResultObject
For information on how to turn off the above logging or skip these errors,
see https://github.com/gadicc/node-yahoo-finance2/tree/devel/docs/validation.md.
At the end of the doc, there's also a section on how to
[Help Fix Validation Errors](https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/validation.md#help-fix)
in case you'd like to contribute to the project. Most of the time, these
fixes are very quick and easy; it's just hard for our small core team to keep up,
so help is always appreciated!
Error: Failed Yahoo Schema validation
Environment
Browser or Node: Node
Node version (if applicable): v20.10.0
Npm version: 10.2.3
Browser version (if applicable):
Library version (e.g. 1.10.1): v2.13.3
Additional Context
Thanks, @shihabuddin.
This might be the case of:
we may just be protecting you from "bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side).
What kind of result were you expecting here?
https://finance.yahoo.com/quote/XAU/ looks pretty empty.
I am trying to find gold spot prices. I thought XAU is the symbol for that. Do you know what is the correct symbol for that?
Hey, no, unfortunately I don't know the correct symbol for that 😅
I suggest to try find it first on https://finance.yahoo.com/, the library should work with anything you can find there.
Closing since validation correctly threw on invalid data, and, unfortunately, we can't provide help with finding symbols.