BenBrostoff / draftfast

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

player position availability update? #182

Open rickenrocker24 opened 2 years ago

rickenrocker24 commented 2 years ago

Fanduel made changes this season for player position availability

rickenrocker24 commented 2 years ago

Any updates on the UTL position

BenBrostoff commented 2 years ago

Yo! I think this could be easily done if you send me a CSV or just example of what a lineup looks like - I haven't been playing FanDuel much over the last two years so have fallen out of touch with what this format looks like. Let me know and I think this is easy-ish to do.

rickenrocker24 commented 2 years ago

Thanks for your prompt response @BenBrostoff below is an example of the fanduel mlb lineup construction...basically they added the "UTIL" position at the bottom and now players can have multiple position. Example below...

image

BenBrostoff commented 2 years ago

Ah gotcha, let me see what I can do here

BenBrostoff commented 2 years ago

Was taking a look here - what's the current issue with how this is implemented? I see FD_MLB_RULE_SET allows for 9 players and you can have 2 of any non pitcher. Is it how CSVs are parsed / what's a specific example of where you're seeing this not working?

Snippet on what I'm seeing:

>>> from draftfast import rules
>>> rules.FD_MLB_RULE_SET
<draftfast.rules.RuleSet object at 0x7f7b901a5d00>
>>> vars(_)
{'site': 'FAN_DUEL', 'league': 'MLB', 'roster_size': 9, 'position_limits': [['P', 1, 1], ['1B', 1, 2], ['2B', 1, 2], ['3B', 1, 2], ['SS', 1, 2], ['OF', 3, 4]], 'general_position_limits': [], 'salary_min': 0, 'salary_max': 35000, 'offensive_positions': None, 'defensive_positions': None, 'game_type': 'classic', 'max_players_per_team': 8, 'position_per_team_rules': None, 'min_teams': None}
rickenrocker24 commented 1 year ago

I've attached samples of projections and salary(from FD) I used, when entering the lineup in fanduel it does not lineup and I would need to move players around to make it fit in some cases.

MLB_SALS.csv MLB_PROJECTIONS.csv

image

image

usage:

from os import environ from draftfast import rules from draftfast.optimize import run_multi from draftfast.csv_parse import salary_download, uploaders

""" Script to create 3 mlb lineups for Fanduel.

Assumptions:

players = salary_download.generate_players_from_csvs( salary_file_location='./MLB_SALS.csv', projection_file_location='./MLB_PROJECTIONS.csv', game=rules.FAN_DUEL, )

rosters, _ = run_multi( iterations=3, exposure_bounds=[

{

  #    'name': 'Freddy Peralta',
  #    'min': 0.1,
  #    'max': 0.5,
  #},
  #{
  #   'name': 'Shane Bieber',
  #   'min': 0.1,
  #   'max': 0.5,
  #   
  #,

], rule_set=rules.FD_MLB_RULE_SET, player_pool=players, verbose=True, )

BenBrostoff commented 1 year ago

So in example you posted, is the issue with Miranda or Smith? Looks like former has catcher eligibility and latter has 1B

On Wed, Sep 21, 2022 at 5:19 PM c0inigr @.***> wrote:

I've attached samples of projections and salary(from FD) I used, when entering the lineup in fanduel it does not lineup and I would need to move players around to make it fit in some cases.

MLB_SALS.csv https://github.com/BenBrostoff/draftfast/files/9620426/MLB_SALS.csv MLB_PROJECTIONS.csv https://github.com/BenBrostoff/draftfast/files/9620427/MLB_PROJECTIONS.csv

[image: image] https://user-images.githubusercontent.com/17555582/191612173-9036f290-e135-4cc9-8194-8939449e1b8f.png

[image: image] https://user-images.githubusercontent.com/17555582/191612231-8906a174-3fdd-422b-8783-2bb64e73c899.png

usage:

from os import environ from draftfast import rules from draftfast.optimize import run_multi from draftfast.csv_parse import salary_download, uploaders

""" Script to create 3 mlb lineups for Fanduel.

Assumptions:

  • Environment variable called "downloads" has path to downloads
  • In downloads, salary, projection and player ID files exist with the filenames listed in the script. """

players = salary_download.generate_players_from_csvs( salary_file_location='./MLB_SALS.csv', projection_file_location='./MLB_PROJECTIONS.csv', game=rules.FAN_DUEL, )

rosters, _ = run_multi( iterations=3, exposure_bounds=[

{

'name': 'Freddy Peralta',

'min': 0.1,

'max': 0.5,

},

{

'name': 'Shane Bieber',

'min': 0.1,

'max': 0.5,

#

,

], rule_set=rules.FD_MLB_RULE_SET, player_pool=players, verbose=True, )

— Reply to this email directly, view it on GitHub https://github.com/BenBrostoff/draftfast/issues/182#issuecomment-1254239296, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVK35ERJ4EOI3HYXYQPSWDV7N3W3ANCNFSM5HJYKYYA . You are receiving this because you were mentioned.Message ID: @.***>

rickenrocker24 commented 1 year ago

Miranda. So if I were to put Miranda on 3B (since C/1B is taken by will smith), then Flores would go to 2B but know Ryan McMahon (3B) will not fit into the roster.

Players now can have multiple positions and Fanduel has a UTIL (like a FLEX position) position which can be any position.