whatadewitt / fantasyapp

Example Application
http://freddybeachbaseball.herokuapp.com/
GNU General Public License v2.0
6 stars 1 forks source link

Yahoo! Fantasy Value Calculator

This is a simple fantasy baseball application I wrote that will query the Yahoo! Fantasy Sports API to automatically calculate the team values in your league.

I wrote this as a quick way of managing my own fantasy league's salary cap, but there was some interest in it so I have put it here on GitHub for anyone interested to enjoy.

The application works by reading your league's ID entered in a configuration file and will check your league transactions and cache the most recent transaction number. If the last transaction number does not match up with the cached number, the league rosters will be pulled and compared against the league draft cache to calculate team values.

The code was put together pretty quickly, and I do plan on making improvements, but in the meantime it serves its purpose.

The application is built using NodeJS and a Mongo Database. I wrote the application as a learning experiment to learn both the Yahoo! Fantasy API and MongoDB.

Requirements

Installation

git clone [git-repo-url] fantasyapp
cd fantasyapp
npm install

Create a Yahoo! Fantasy Application

Configure Application in conf/conf.json

Populate league teams and draft

In a "not the most ideal way" to do things, you'll first want to navigate to /getleagueteams to pull down the teams in the league.

Next, navigate to /pluckdraft to pull down and cache the league draft results.

Finally, you can visit / to pull down the team rosters and calculate and display team values.

Deployment

I deployed this app to Heroku pretty easily. It was the first app I've really deployed to Heroku. I added a MongoHQ instance, as well as with New Relic at a cost of $0.

License

GPLv2