zlisto / Daily-Fantasy-Baseball-Contests-in-DraftKings

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).
37 stars 27 forks source link

Customization questions #6

Open asardinha opened 5 years ago

asardinha commented 5 years ago

New Julia user so after playing with the source code for a little bit, I’m wondering if anyone can help.

I’m interested to see if/how this can be customized to FanDuel constraints. Salary requirement are easy to change but I’m getting errors when trying to lock in positions. Fanduel uses a “C/1b” position that can be either a catcher or first basemen and one utility player that can be any field position. I’m trying the suggestion from an earlier issue, I’m getting several error codes.

Also, is there a way in Julia to set exposure? For example if I only want 40 percent of the payer pool how would I go about making an addition constraint?

Suggestions would be greatly appreciated. Please let me know if I can provide any additional information.

jnederlo commented 5 years ago

I'll collaborate with you to implement this all in Python if you know that? I've already built most of one for NBA and it would be pretty quick to add MLB. Otherwise, when I have some more time I can try to implement the multiple position constraint in Julia. I can tell you from my time building an NBA optimizer, it can be a tough constraint to address. For the max exposure, you could just make a new constraint that makes it so any one player couldn't be in more than x lineups. The syntax for JuMP and Julia is not something I enjoy though, so again, I'll defer to python.

asardinha commented 5 years ago

On a scale from 1-10, I would say that I'm more at the "2" level with python proficiency but would use this opportunity to learn/collaborate with you.

I can move this to a direct message so that we can discuss further.

Thanks again for your help.

I also saw that you have a hockey version of what you are describing, would you be interested in working on that a little more to add some constraints (line stacking, max exposure, goalie correlation)?

realguy211 commented 5 years ago

I'm having the same issues and would also appreciate the help. I am still learning Julia so my knowledge is very limited. How can i create a constraint to set player exposure and how do i add a utility position ?

Thank you again in advance.

jnederlo commented 5 years ago

I'm converting the julia optimizer to python for NHL, after which maybe I'll do MLB, but either way it will be way easier to understand and modify. I'll post here when I do.

jzorn164 commented 5 years ago

@jnederlo

I already have a python optimizer for MLB that is based very similar to this. It can be quite easily tuned to NHL. However, it is held up in two main areas, the so-called "Goalie Stacking" and "Lineup-Overlap". If you have an idea on how to implement those I will be glad to collaborate with you if you need help building the Python version of this.

I think the lineup-overlap shouldn't be too difficult, mainly because there are plenty of finance codes out there for portfolio management that can return variance portfolio set. However, I am confused about how to implement the "Goalie Stacking", or in MLB "Pitcher Stacking", in Python.

asardinha commented 5 years ago

@jnederlo @jzorn164

I'm not sure if this will help, but I've worked out some kinks to make sure there is a UTIL player (FanDuel rules).

https://github.com/asardinha/JuliaTest

I'm done some back testing with FantasyCruncher Projections and they do alright, but nothing spectacular.

jnederlo commented 5 years ago

@asardinha I've completed the NHL code for python, the rough version is on my github (putting there now), it's not refined yet, but I will be writing a medium post about it to explain it. Let's try to get it done for mlb next (i.e. in python). If I recall, when I went through the julia mlb one in this repo I found some mistakes. I can't remember what they are as I changed all the files.

Python is slower, but not by much, and is much easier to read in my opinion. I think it would be a good idea to get it working and test in python, and then replicate back into julia if concerned about speed.

I also have projections that fare much better than fantasyCruncher. If you can help me build the mlb optimizer (i.e. make a pull request - it should be really easy to do) then I can provide the projection files to backtest.

dachel12 commented 5 years ago

@jnederlo @asardinha have you guys been able to make the MLB optimizer work? If you have I'd be very interested in using it, if you are willing to share.