To support a new sport or DFS site not currently covered by the library, you must define a custom settings class. This is done by inheriting from BaseSettings and specifying the rules and constraints for your specific use case.
Key attributes to define in your BaseSettings subclass include:
site: The name of the DFS site.sport: The name of the sport.budget: The total budget allowed for a lineup.max_from_one_team: Constraint for the maximum number of players allowed from a single team.min_teams: Constraint for the minimum number of different teams required in a lineup.min_games: Constraint for the minimum number of different games required in a lineup.csv_importer: The importer to use if players are loaded via the load_players_from_csv method.positions: A list of LineupPosition objects defining the lineup structure.
from pydfs_lineup_optimizer import LineupOptimizer
from pydfs_lineup_optimizer.settings import BaseSettings, LineupPosition
class CustomSettings(BaseSettings):
site = 'Site Name'
sport = 'Sport Name'
budget = 100 # budget you want to use
max_from_one_team = None # if needed
min_teams = None # if needed
min_games = None # if needed
csv_importer = None # If player will be imported using load_players_from_csv method
positions = [ # list of all positions
LineupPosition('G', ('PG', 'SG')), # First argument is name of position in lineup,
# second is allowed player positions for this lineup position
]
optimizer = LineupOptimizer(CustomSettings)