BenBrostoff / draftfast

A tool to automate and optimize DraftKings and FanDuel lineup construction.
278 stars 113 forks source link

[Request] Make it easier to add custom sites, rules, and leagues #135

Closed robotfactory closed 5 years ago

robotfactory commented 5 years ago

Right now if you want to add a site or rule set it's pretty easy to add to (or overload) rules.py, but if you want to add a league (say, a type of battle at a particular weather-themed DFS site) you've got to also modify classes in orm.py and optimizer.py. This makes it super difficult if you're using the pip package.

I don't know how to design it, but it'd be great if the rules, leagues, and sites could be configured in a more modular fashion, possibly more centrally.

BenBrostoff commented 5 years ago

@robotfactory 100% agree, I may be using a forked version of draftfast for this hypothetical weather-themed site :-). Ideally this should be as simple as:

WEATHER_BATTLE = RuleSet(
    site='WBattle',
    league='WEATHER',
    roster_size=10,
    salary_max=40_000,
    position_limits=[['City', 10, 10]],
    general_position_limits=[],
)

but you also need to add to override roster_gen I think as well. Either way, I agree on there being bad docs and the code perhaps not really lending itself that well to this. Do you want to take a shot at refactoring? I can also see how this would be done with the pip package only, get you an example and then we could go from there.

robotfactory commented 5 years ago

I can try but I'll be honest: I'm a security guy, not a developer. It's gonna be ugly.

I like the idea of a wxdfs fork, though. I'd contribute to that.

If you've got ideas on how to do the weather games with just the pip package, I'd love to see them. I'm still getting my head around how everything connects and I haven't even peeked under the hood of the solver yet.

BenBrostoff commented 5 years ago

👍 , when I have some time (possibly tomorrow) I'll put together a repl.it with how this would work for Weather Battle. I'm also considering adding tennis for DraftKings but if I can figure out a good way to add sports without changing the source code and through the exposed API only, I'd rather go that route.

BenBrostoff commented 5 years ago

Closing this one as I think the README has a good example of adding new sports. I definitely welcome PRs with new sports from DraftKings or FanDuel or even Weather Battle.