yahooFinance.dailyLosers is not a function
Hey Guys,
I am using the latest version 2.13.3 of Yahoo Finance 2 and i get the following error trying to use dailyLosers endpoint: yahooFinance.dailyLosers is not a function
The dailyGainers endpoint however, seems to work. (though it has a different Schema, but when turning off validateResult it works)
Does someone know why dailyLosers doesnt work but dailyGainers works?
Thanks!
+1, same happened
+1
Hey all, thanks for the patience here... I've been travelling and am struggling a bit at the moment to keep up with everything 😅
Unfortunately I don't have any time to look back at v2. Also unfortunately, v3 is not an "official" release yet, however, it does exist, and an increasing number of people are using it in production. See UPGRADING.md for info on how to use it. The main drawback is that most of the docs still refer to v2, but, if you read the UPGRADING doc, I think you'l be ok :)
Now, on to the issue. Thanks for reporting!
-
dailyLosers()does in fact exist in v3, however, there are some validation issues just like withdailyGainers()- as you pointed out. -
However, we plan to remove both
dailyGainers()anddailyLosers()and focus exclusively onscreener(), which is the underlying API used to provide this functionality. -
In the latest v3 release, v3.5.0, which was just published now, I have just fixed all the validation for the above functionality.
You basically want:
const dailyGainers = yahooFinance.screener("day_gainers");
const dailyLosers = yahooFinance.screener("day_losers");
You might find some more info in the screener.md docs, just bare in mind it's still from v2, sorry about that. It also doesn't include the new shortcut to specify the screener name directly instead of as { scrIds: "day_gainers" }.
Hope this helps! Sorry things aren't quite how I'd like but at least you have access to all this functionality again now.
Closing since this has been working for a while now. I'll just add that the old dailyGainers() and dailyLosers() modules now throw an error with helpful instructions on how to use screener() instead.
Again, I refer to v3, and although it's not yet "official", nor marked with the @latest tag, many are using it succesfully. For more info on upgrading, see UPGRADING.md. Unfortunately, I don't have the capacity to backport fixes or code back to v2.