– Fantasy Stat Tracker …Tracker

A blog about the development of – The Fantasy Baseball Stat Tracker

Posts Tagged ‘mlb’

Spring Training Stats

Friday, April 5th, 2013

I’ve been getting a flood of emails about spring training statistics showing up for players that haven’t played in the big leagues yet this year. collects all of its stats for an XML feed that MLB publishes. Every time you request the stats for your team(s), checks to see what the latest stats are and loads them into the system.

Unfortunately, it seems that MLB leaves springs stats listed for all players that appear in the spring but are then sent to the minors (or DL). Until they appear in a big league game, MLB will continue to show springs stats in their feed.

This is just how it works.

If you have a player on your team that is showing spring stats, please move that player to your bench. The player’s individual stats will still show from spring, but this will remove the player’s stats from your team totals.

I love Kilgus! Can you include [STATX]?

Friday, April 6th, 2012

This is by far the most common topic when people email me about I’m thrilled that so many people are enjoying the tool (we start the year with over 1800 members, nearly 500 users per day), but these are bummer emails to receive.

Unfortunately, 95% of the time the answer: No, sorry.

As a free tool, needs to rely on whatever free stats we can find. As it turns out, MLB publishes some limited live data (I believe for their GameDay feature) that we’ve been able to tap. While it is great that the data is free, the bummer is that it isn’t comprehensive. is already pulling every stat available from MLB and even calculating a whole series more that aren’t made available in the data feed.

If you’re favorite stat isn’t included, it’s almost certainly because we just don’t have access to it. At the start of each season, I double-check the feeds to see if any new stats are available. This year, there is nothing new.

So, if there is something that can be calculated with the data already in, let me know and I’ll be happy to add it! If you want a new counting stat added, though, I can’t add it.

Maybe someday an angel investor will throw a pile of money at and we can afford to purchase a real data feed (~$25k/year). Until then, we just have to make due with what we have.

Hopefully it’s enough to be useful to you!

(That said, don’t forget to click “Select Stats” for each of your teams to see all the stats that are available: currently 32 categories!)

Update on Boxscore Emails and More

Saturday, April 9th, 2011

This morning on Facebook I mentioned a few goals for fixes and improvements to this weekend. Those items were:

  1. update MLB player/team lists
  2. get email boxscores working
  3. speed up stat collection
  4. trim players that show up on the “Major League Baseball” team rosters (right now it includes players throughout all the minors, with no respect to whether they might actually appear in a real game…

I’m pleased to report that numbers 1 and 4 are soundly completed! As of this morning, all active MLB players should be listed in and associated with their correct teams. If you follow any of the “Major League Baseball” teams, those rosters should also be cleaned up to only show players on that team’s 40-man roster.

Unfortunately, 2 and 3 are stills works in progress. I have made some changes to the model for how player objects are created. The result of this change is that player stats are only refreshed from when needed, rather than any time a player is referenced. In practice, loading a team page requires that a player’s stats be up-to-the-second. When a daily boxscore email is generated in the wee hours of the morning, though, there is no need to go gather latest stats–they haven’t changed in the hours since the games all ended.

In my testing so far, team pages are loading 10-40% faster now. I’m still not happy with their performance, but at least it is progress. When I try to generate all the daily emails, those are running significantly faster. Before today, the process was trending towards 90 minutes, timing out, and failing. Now the process is hammering through 80 (of ~360) emails in the first minute and sending emails properly. At that point, the server slows to a crawl and, while it continues to output the email content, it refuses to send the emails.

I considered reaching out to the hosting company for help in identifying why their system was doing this, but I’ve given up. The company (AMS Computer Services) and infrastructure that hosts sucks. I’m going to try moving to a cloud hosting solution from Rackspace. I’ve spent a good part of the day getting the new server up and configured. Tomorrow I should be able to start moving over, testing, troubleshooting, and seeing how it performs. It’s going to be a long, tedious, frustrating process but it can’t possibly be worse than sticking with the status quo.

In the meantime, my fingers are crossed that our daily boxscore emails will fire off properly in the morning…but I’m not holding my breath.

The reason I’ve mentioned in the past for not making the move to a new hosting solution (besides the time and effort) is that it will cost more than the current option. Because is going to cost me more to host now, I’ve added a PayPal donation button to give anyone interested the option in helping to support I’m not hoping to make anything off, but it would be great it is wasn’t a financial burden. If you like using, I hope you’ll consider giving a little bit to help offset my costs. $5, $10, $1, anything will help!

I hope to have an update with good news by tomorrow evening as I start to migrate

Season Stats: WHIP

Sunday, April 11th, 2010

A comment yesterday brought to my attention that was not showing WHIP values for individual players on their Season-to-Date stats. This was an oversight in an assumption I made about the data was collecting and storing.

Each time renders stats, it checks to see if the latest stats are in the database or if they need to be collected. If the latest ones are in the database, it displays those. If not, it collects the new ones, saves them, and displays them. The XML data from MLB contains the season WHIP stat for each pitcher. So I assumed I was also storing that value in the database.

As it turns out, I wasn’t. The database stores the counting values (innings, hits, walks, etc).  then calculates the average stats (WHIP, ERA, k/9, etc.) based on the counting stats. In the Pitcher object, it was attempting to pull the WHIP value from the dataset returned, which works when collecting new stats from MLB. When the latest stats are in the database, though, that WHIP value doesn’t exist, so “-.–” is displayed instead.

I have updated the Pitcher object to calculate the WHIP value whenever it is needed. This means WHIP should be displaying in Season-to-Date stat views now. If you find otherwise, let me know!


Friday, March 26th, 2010

I haven’t posted about any changes for a couple days, but there has been a little going on. In my defense, I started a “Road to the Show” career in MLB 2010 The Show, so I MIGHT have been spending a little more time honing by batting skills than publishing about changes.

On the fixes side, there were some issues around gathering players and adding them to Those have been revised now, so any player on a 40-man roster should be showing up (and then some). If you don’t see someone that you want on your team, post a comment or let me know.

There is an outstanding issue with rookies, though. I think I’ve narrowed it to the stored procedure that saves player stats, but all rookie pitchers show a blank (no zeros, no stats, completely blank) stat line regardless of their performance. This is next on the list of things to fix.

Next up, when players were being collected from, they were added to the official “Major League Baseball” owner’s teams if they didn’t currently exist on the appropriate roster. They weren’t, however, being removed from their previous team if they had been traded or were a free agent (rather than a rookie). This never seemed to come up last year, but there code I changed to fix the problem hasn’t been touched in nearly a year, so I’m not quite sure the root of the problem. Hopefully it is resolved going forward.

On that note, keep in mind that you can follow any MLB team’s stats by adding the owner “Major League Baseball” to your friends. That particular owner has all 30 teams with rosters that are automatically updated to have all the latest players.

Among new features for 2010, there are three more items I hope to get out by opening day (or very shortly thereafter):

  1. Apply the new theme to the …Tracker blog
  2. Implement Lucene for Add Player searches
  3. Create a Season-to-date view of a team’s stats (cumulative for the season, not respective of adds/removals during the year; this was a request from a Strat-o-matic owner–hopefully others will find use in it)

Opening Day is barely a week away!

MLB Team Rosters

Monday, April 27th, 2009

Tonight I updated the mechanism in which gathers all the players for the Major League Baseball Teams. The old process involved some manual intervention. The new process is entirely programmatic. At the moment, I need to kick off the process manually, but I hope to get it scheduled here in the near future. I want to optimize the process a bit before tossing it in a CRON job, though. Right now the process takes about 2 minutes to run and generates about 3200 PHP Warning messages.

All the warning messages are generated by a series of HTTP requests. The way the process determines if a player is on a major league roster is by checking if the player has an XML file on the MLB server for the current day. If the file exists, ensures that player is on the proper team. If the file doesn’t exist, deletes any records of that player from the proper team. This also generates 2 Warning messages per failed HTTP request, though.

I’ll keep an eye on things, see if I can clean it up, and run the script every few days to keep the MLB teams up-to-date. Depending on how things go, I might go ahead and schedule the task or I might re-write it.

Another update today was in the Javascript that calculates the number of innings your pitchers have thrown on a given day. In the past, if your team had thrown an increment of innings that included 1/3 of an inning, your total innings probably rounded that up to 2/3.  This was because of a basic flaw in my logic for calculating those partial innings. I’ve corrected it (actually re-writing the entire function) and now innings pitched should be tallied properly.

Various Searching Updates

Sunday, April 26th, 2009

I added and changed some functionality in both of the search flows in Find Owners and Add Players.

In the Find Owners section, I added a one-click method to add Major League Baseball Teams to your industry. As mentioned previously, the Major League Baseball Teams user was created to house all the 30 MLB teams. The teams include all the players that has associated with each of the teams. Currently, this is 80-100 players per team. This week I hope to trim that down to some more manageable roster sizes (25- or 40-man rosters, hopefully).

The Add Players section has received some feedback lately about the confusion when using the Filter Position drop-down. This was expected when I updated the player search behavior a few weeks back (adding in paging). I’ve updated the player search to now accommodate for searches of names and positions simultaneously. Hopefully this will be more logical for new Users. As always, I welcome feedback–let me know if it is working better or worse for you.

Track MLB Teams

Monday, April 6th, 2009

I’ve set up a “Major League Baseball” Owner that owns all 30 major league teams. If you would like to track stats of your favorite team (or any other team, for that matter), I would recommend you add this Owner to your Industry and use his rosters. I’ve written a script to update all the major league teams’ rosters will all the official data from MLB so you don’t need to constantly tweak a team you’ve personally defined.

One draw-back right now: when I pulled all the players onto their teams I found that MLB was publishing data for every player that was in spring training. So most teams have between 80-100 players on their stats pages. I’m looking into ways to fine-tune the rosters so they only show 25-man active rosters, or at least 40-man rosters.

If you would like to add Major League Baseball to your industry, but don’t want all 30 teams exposed to your User, shoot an email to mlb [at] with your name/email and the teams you would like to be able to view. I’ll set the permissions for you.