BenBrostoff / draftfast

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

Generate N Lineups Without Removing Random Player #62

Closed ravashjalil closed 6 years ago

ravashjalil commented 6 years ago

Hi, great app you got here, I've never been able to truly understand google or tools to the fullest, but it's extremely fast and that's what got me interested in your app.

The issue I'm having is trying to generate let's say 100 lineups in the NBA, without randomly removing a player, just rather based on total projected points. I understand you implemented the randomness to get rid of similar lineups, but that's the thing I've been trying to reverse. Any tips on how?

BenBrostoff commented 6 years ago

Hey @ravashjalil - there are a number of options you have here depending on how you want to go about constructing lineups. Let's say you want to remove the lowest value player (see this blog post for an explanation of value).

Instead of something like this that just removes a random player:

args['banned'].append(
    random.choice(roster.players).name
)

You could remove the lowest value player via:

def get_lowest_value(roster):
      return sorted(roster.players, lambda p: p.value)[0]

args['banned'].append(
    get_lowest_value(roster).name
)

You could also consider removing the lowest projected point scoring player, the highest projected point scoring player (this will lead to more balanced lineups), etc.

Take a look at my Patreon and consider the KG tier if you're interested in personalized consulting each month.

Because this question is not related to the functionality of the library, I'm going to close this issue. That said, feel free to e-mail me with any follow-ups.