Daily Fantasy Baseball Contests In DraftKings Save

This is the code for constructing a portfolio of lineups for DraftKings baseball contests with a top heavy payoff structure. This code is based on the paper Picking Winners Using Integer Programming by David Hunter, Juan Pablo Vielma, and Tauhid Zaman (https://arxiv.org/abs/1604.01455).

Project README

Fantasy Baseball Lineups Optimization Code

This is the code for constructing a portfolio of lineups for DraftKings baseball contests with a top heavy payoff structure. This code is based on the paper Picking Winners Using Integer Programming by David Hunter, Juan Pablo Vielma, and Tauhid Zaman. Below are details on the required software, and instructions on how to run different variations of the code.

Required Software

To start off, you should download Julia from the corresponding site above. Then, open Julia and run the following commands

julia> Pkg.add("JuMP")
julia> Pkg.add("DataFrames")
julia> Pkg.add("GLPKMathProgInterface")
julia> Pkg.add("MathProgBase")

As we noted in the paper, GLPK and Cbc are both open-source solvers. This code uses GLPK because we found that it was slightly faster in practice for the formulations considered. For those that want to build more sophisticated models, they can buy Gurobi. Please consult the JuMP homepage for details on how to use different solvers. JuMP makes it easy to change between a number of open-source and commercial solvers.

Downloading the Code

You can download the code and the example csv files by calling

$ git clone https://github.com/zlisto/dailyfantasybaseball

Alternatively, you can download the zip file from above.

Running the Code

Open the file optimize_multiple_lineups_baseball.jl. By default the code will create 150 lineups with a maximum overlap of 6 players between each lineup, and a stack of 5 consecutive batters. To change this, see lines 13, 16, and 19 in the file. For instance, if you want to create 10 lineups with a maximum overlap of 4 players, and a stack of 3 consecutive batters you change lines 13, 16, and 19 to the following

num_lineups = 10
num_overlap = 4
stack_size = 3

Lastly, you can change the path_pitchers, path_hitters, and path_to_output variables defined on line 25, 26, and 29 respectively, to the name of the corresponding files for the pitcher and hitter projections and the output lineups.

Good luck!

DK Mafia

Open Source Agenda is not affiliated with "Daily Fantasy Baseball Contests In DraftKings" Project. README Source: zlisto/Daily-Fantasy-Baseball-Contests-in-DraftKings
Stars
35
Open Issues
16
Last Commit
5 years ago

Open Source Agenda Badge

Open Source Agenda Rating