Skip to content

Setting min_exposure in Fanduel Single Game #433

@EdCarGoes

Description

@EdCarGoes

Hello again. I think I'm really close to adding a workaround to be able to lock players in the single-game formats with MVP and FLEX.

Below is an example where I am testing to try and force Derrick Henry into a certain number of lineups with a specified exposure in the MVP slot and a different specified exposure for one of the FLEX slots. Note: fdpos is a dataframe with just names an positions, used to look up a player's given position in a full slate. In this case it returns RB.

mvp_player = optimizer.player_pool.get_player_by_name('Derrick Henry', 'MVP')
mvp_player.min_exposure = .1
original_position = fdpos.loc[fdpos['Nickname'] == 'Derrick Henry', 'Position'].iloc[0]
flex_player = optimizer.player_pool.get_player_by_name('Derrick Henry', original_position)
flex_player.min_exposure = .3
force_group = PlayersGroup((mvp_player,flex_player), max_from_group=1)
optimizer.add_players_group(force_group)

When I run this I get the error:

Exception has occurred: GenerateLineupException
Can't generate lineups. Following constraints are not valid: total_players,unique_player_Derrick_Henry

So it looks like the force_group is not being applied successfully. Does anyone know why?

Changing mvp_player.min_exposure to 0 works as expected and 30% of the returned lineups feature Derrick Henry in a flex position. And inversely, if I set flex_player.min_exposure to 0 I get 10% of lineups with Derrick Henry as MVP. So again, it seems like the max_from_group is being ignored and it's trying to make at least one lineup with Derrick Henry in both the MVP and FLEX slots. What is the correct solution here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions