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

Fix null currency validation error

Open dnicolson opened this issue 6 months ago • 2 comments

Closes # .

Changes

Type

  • [ ] New Module
  • [ ] Other New Feature
  • [x] Validation Fix
  • [ ] Other Bugfix
  • [ ] Docs
  • [ ] Chore/other

Comments/notes

The following error:

{
  "type": 54,
  "schema": {
    "type": "string"
  },
  "path": "/meta/currency",
  "value": null,
  "message": "Expected string"
}

Was tested with:

deno task cli chart LUCYW '{"period1":"2025-01-01","period2":"2025-01-02"}'

dnicolson avatar Jun 15 '25 21:06 dnicolson

Hey, @dnicolson. So sorry for my late reply while I've been travelling.

Thanks for the perfect PR! Appreciate the time taken to figure out how everything works, tests, etc.

I'm just trying to figure out exactly what's going on here on Yahoo side. We do sometimes rely on the validation to protect against "bad" data from Yahoo. I'm not sure what it really means if a stock doesn't have a currency :sweat_smile:

Looking at https://finance.yahoo.com/quote/LUCYW/, there's clearly still enough useful data there that I guess we should still enable access to... but I note even an "undefined" (in text!) at the top where the currency should be.

I'd love your thoughts on this kind of situation... if it's better to allow this, or consider this an error which the user should catch and handle appropriately. Have you ever come across this situation on any other stock? Did you notice anything else weird on this stock on particular?

Thanks again for your contribution here and would be grateful for your opinion on this. And sorry again for the late response, I really do try to prioritize PRs whenever possible.

gadicc avatar Jun 30 '25 10:06 gadicc

I don't have a strong preference here, whether it be validation or improved error handling.

It appears that only limited data is available for this warrant stock. On Yahoo Finance, the market cap isn't available and appears as "--". In the comparison section, "undefined" probably appears due to a presentation bug.

dnicolson avatar Jul 07 '25 21:07 dnicolson