scheb / yahoo-finance-api

PHP client for Yahoo Finance API 📈
MIT License
280 stars 56 forks source link

getQuotes with a invalid symbol #34

Open glaucoheitor opened 3 years ago

glaucoheitor commented 3 years ago

When using $client->getQuotes($symbols), if one of the symbols is invalid or Yahoo don't have information about, the class will just skip it, so if I sent an array with 20 elements, I may get a return with only 18 elements.

I would like to suggest one of this options as a solution:

I'm not sure if I expressed myself well enough, but if not, please send me questions so I can clarify.

Thanks!

scheb commented 3 years ago

Yea, understood. Would definitly make sense to get some better support from the library when dealing with these multi-fetch requests. Right now it's just transforming the data from the API and the API skips unknown symbols. I agree it would be great to have a more convenient way to figure out if the result was complete and what's missing.

eversionsystems commented 2 years ago

This was also an issue for me but what I ended up doing is just calling the "getSymbol()" function on the returned quote to validate what stock ticker the result was referring to.