-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
19 lines (10 loc) · 1.16 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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.