Giter Club home page Giter Club logo

siyu / daily-fantasy-baseball-contests-in-draftkings Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zlisto/daily-fantasy-baseball-contests-in-draftkings

0.0 2.0 0.0 41 KB

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).

Julia 100.00%

daily-fantasy-baseball-contests-in-draftkings's Introduction

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

daily-fantasy-baseball-contests-in-draftkings's People

Contributors

zlisto avatar

Watchers

 avatar  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.