Code Monkey home page Code Monkey logo

fanduel-nba-optimizer's Introduction

FanDuel NBA Optimizer

This is a simple NBA lineup optimizer for daily fantasy sports (DFS) on FanDuel. It accomplishes this by using a variation of the knapsack problem. The purpose of this project is to demonstrate one possible use of Google's free or-tools library, and the code is designed to be easy to read and understand.

What is an optimizer?

An optimizer takes a set of projections (that is, a csv file containing a list of NBA players, their salaries, and the number of fantasy points that each player is expected to score), and calculates an optimized lineup that maximizes the number of expected points without exceeding the salary cap. The goal is to assemble the best possible fantasy team for a given day.

What are the prerequisites?

All you need is python (which you probably already have) and Google's or-tools library.

Where do I find projections?

You can get free projections from various DFS websites, such as:

However, you will probably have better results (and more fun) by learning to develop your own projection strategies.

Example usage

$ python nba-optimizer.py example_2016-01-04.csv

Example output

Solved in 149 milliseconds!

Karl-Anthony Towns (C): $7,800 (37.9)
Russell Westbrook (PG): $10,700 (54.3)
Isaiah Thomas (PG): $8,100 (37.6)
Serge Ibaka (PF): $6,200 (31.9)
Frank Kaminsky (PF): $4,000 (29.1)
Jeremy Lamb (SG): $4,300 (23.7)
Gerald Green (SG): $3,800 (20.1)
LeBron James (SF): $9,800 (44.7)
Marcus Morris (SF): $5,300 (26.8)

Total: $60,000 (306.1)

fanduel-nba-optimizer's People

Contributors

davehensley avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.