Skip to content

Pull down MLB's official XML datafeed and parse out moving averages of players' wOBA

License

Notifications You must be signed in to change notification settings

sirsean/MLB-Datafeed-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MLB provides an official stat feed, in XML format, located at http://gd2.mlb.com/components/game/mlb/. This is the exact same data used in MLB's own applications, such as the GameDay Flash app and the MLB At Bat application for iPhone/iPad/etc. Thus, the format will probably change slowly if at all, and they should continue to provide it so those apps can use it.

The license says you can use the data for non-commercial, non-bulk purposes. Bear that in mind.

Download the XML files to your xml/ directory (which will be created automatically, if necessary), like so:

    rake download

It will download every file that you don't already have, for the entire year (including spring training).

Then you can process the XML files, creating a CSV with the 10-day moving average of wOBA, by team. For example, if you wanted a graph of all the Twins' hitters starting on Opening Day:

    rake parse_team[2011-04-01,min]

Or, you can specify which players you care about:

    rake parse_players[2011-04-01,"Joe Mauer:Justin Morneau:Jason Kubel:Miguel Cabrera:Albert Pujols"]

I then upload the CSV to Google Docs to generate a line chart, but you can do whatever you want with it.

About

Pull down MLB's official XML datafeed and parse out moving averages of players' wOBA

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages