-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accumulating rate stats? #104
Comments
I think what you're looking for is the https://yahoo-fantasy-node-docs.vercel.app/resource/team/stats If I use my league ID and the date in the proper format I get
You'd need to pair it with the (Apologies for the delay, I don't get notified of issues!!) |
No so that's what I'm using for counting stats; basically I loop through every day of the season and just add up the (mapped) stats so that I can get my total HR or RBI on any given day of the season. However, that's not helpful for rate stats. Knowing that I had a 3.00 ERA on a given day doesn't tell me how that affects my overall ERA because I don't know how many IP that ERA represents. So there's no way for me to get my "accumulated" ERA by just averaging out all daily ERAs in the same way I might get my accumulated HR by adding up all daily HRs. What would be helpful would be a way to query Yahoo to ask for my accumulated stats on any given day of the season; i.e. I get the state of my team's (season) stats on a given day. |
Hmm... but for something like ERA and WHIP, you have the value, but there are additional stats that come through with the team.stats resource that indicate the number of innings pitched This was from my team last night
and then I have
for ERA, WHIP, and K/9, respectively. So there might be a bit of work to do, but I do think you can do what you're looking to do... or I am just completely misunderstanding. |
It may be possible to get ERA if I can access earned runs and IP. Can you get everything you need for OBP though? To be honest I'm a bit surprised Yahoo doesn't allow for this. You can use team.stats to get your current accumulated stats, with accurate rate stats for the day on which you're calling the API. You can also add a date to get that day's single stats. But there's no way to add a date to get that day's accumulated stats; i.e. I want to know how many HR I had accumulated since the start of the season on april 15th. |
It's likely they have something internally, but don't expose. I was told by a fella I connect with at Yahoo! from time to time that they don't even really support the public fantasy API anymore. If I could rally enough interest we might be able to get that changed, but I think that for now you'll need to just persist everything to something local I guess you could write a quick script that would just query team.stats each day for the range you pass in to it? I do a lot of multi-call scripts and you really don't have much of a chance of going over any sort of rate limits |
@whatadewitt somewhat related question - do you know of any way to get accumulated stats at the player level? I am looking for exactly what you can see on the My Team -> Team Log page in the UI. In theory, the correct URL seems like it should be Similar to the OP, I can use the URL |
@solewis my gut is telling me this should work, but it's definitely not documented on the Yahoo! side, and therefore I don't have it documented. My first thought would be to try the Based on what you've tested with with the original URL though, I can't imagine it's not possible, it's just a matter of figuring out where we can add the week handler, which I don't think would be overly difficult based on how it's used, but I've just spent about 40 minutes making cURL calls and getting nowhere... I'll take a peek in another bit as I am just working through some other bugs, but this would be phenomenal to have. Thanks for the info! |
Yeah this comment from your Yahoo contact makes me think this data should be accessible (we know it exists since it is in the UI). I have also been playing with the cURL calls and just haven't found the right combo. |
Yahoo! Contact??? 👀 My league is public, so this should work, but it's not... what do I have wrong here? |
I'm not at a computer now but it looks correct to me. I'll try when I get home. Do you get an error? |
No error, but no stats for the players...
(just running a simple script in console...) |
It works for me just using cURL. I see Logan O'Hoppe 5/17 H/AB for the week as the first player for example.
I just meant in that comment I linked (or actually a few comments above) you mentioned you had a Yahoo contact, and that comment was the response you received from them. |
Ah poop! Was hoping there was more! I think I might know the problem... Are you calling that URL directly and seeing the stats? |
Indeed. My "mapRoster" helper function doesn't have anything to handle the statistics coming back. This is PHENOMENAL! I will update this tomorrow or something (it's late here and I am dead tired, but I know what to do now and this will certainly be a fantastic addition to the codebase!!) |
I am calling that URL directly yes. It has all the league specified stats. So for Logan O'Hoppe it has Runs, RBIs, etc as well as H/AB and IP |
The issue is that URL still doesn't return season long accumulations. For runs you could accumulate yourself, but for ERA you can't see for example what Jared Jones specifically has accumulated for that team. |
I'm going to attribute the fact that I'm not understanding this to being so tired 😆 I apologize
I see these stats coming back, where I have the IP and the ERA / WHIP, I could go week by week and accumulate there, no? |
Yeah I suppose you could accumulate with ERA and WHIP since you have IP, that is true. I am in an OBP league, so that is the stat I am specifically thinking of that I can't accumulate just with the stats returned. |
Curious… what stats do you get as the “display_only” stats?
I mean… it might be possible to figure it out through clever math… but it
certainly wouldn’t be easy… and then don’t get me started if you were in a
SLG or OPS league 😬
|
@solewis what's nice is it works for dates as well
edit: although even if they're on the bench, it's giving me full stats :/ |
Yeah it just kind of feels like certain endpoints aren't behaving as they should. I see the same issue where passing a date is just giving full stats. That and I don't have any section called "display_only", but I get IP and H/AB as the only three non-scoring data points, which unfortunately isn't enough to calculate OBP |
Can you share what you get? If you look at the example response here: https://yahoo-fantasy-node-docs.vercel.app/collection/games/fetch you'll see all the base categories for baseball, but it's super frustrating that the "tester" on this page is broken (I will fix that when I am home tonight) I just want to see what data is coming back with these different settings. |
Well I don't actually use this Node API, I just stumbled upon your repo and it was helpful to use as a reference :). I am just testing with cURL. Here is a breakdown of what I am seeing, I can post the actual responses too if that is helpful.
|
but you also have their "selected_position", so you can simply omit anyone who is on your BN or IL
I'm not sure you've got this. I just used mlb.l.11970.t.1 with week 2 and Trevor Rogers is coming back with no stats and I purposefully sat him last week because I didn't trust him in the lineup
I'm seeing the same thing you're seeing here, it's giving me all of Rogers' innings (not including today). I can't speak as to how they do it on their side. I did see your post on Reddit earlier today about this issue. Unfortunately they don't really "support" this API publicly anymore, so I don't know you'll get an answer from them, but I do think you could go day-by-day to find most of what you want |
Yep, true. So again, we have the ability to aggregate ourselves manually for season stats going weekly or daily, but only for certain ones (no way to do it for OBP). Like you say, it doesn't seem like they maintain the APIs anymore, so this will probably be the best we get.
I think we are saying the same thing on this one. This endpoint works as I expect, trevor rogers coming back with no stats is what I am seeing and what I expect to see. |
It's unfortunate, but you would have H/AB and OBP, it's not ideal, but it might not be overly tedious to increment each until you get the proper OBP value? |
Hmm, interesting thought. I'll have to play around with that. If I was better at math I could probably find a smart way to figure it out, but maybe I can code something basic up. |
Easy math in my head tells me they go 1/3 with a .500 OBP you can sort it out pretty quickly. Obviously it gets more confusing as you go up but the nice thing is that there are realistically only so many ABs that can happen if you're looking game to game... |
Thank you @solewis for the notes and discussion. I have added this ability to the APIs source, just in case you decide you want to start using it. Also, if you have any other endpoints you're using that I don't have built into this, I'd love to know so I can add them! https://yahoo-fantasy-node-docs.vercel.app/resource/roster/players |
Definitely, will do. Thank you for talking this through with me! |
Is there a way to loop through every day of the season and get your accumulating score for a rate stat?
In order to find my HR score for any given day of the season, I can check all previous days, and then just add them up.
But for things like ERA, I can't do that. I can't average it either. I would like to find my ERA score for any given day of the season, not my pitchers' ERA on that day.
The text was updated successfully, but these errors were encountered: