Package: tfb-draftfast
IntroductionAn incredibly powerful tool that automates and optimizes lineup building, allowing you to enter thousands of lineups in any DraftKings or FanDuel contest in the time it takes you to grab a coffee.InstallationRequires Python 7.pipinstalltfb-draftfastUsageExample usagefromdraftfastimportrulesfromdraftfast.optimizeimportrunfromdraftfast.ormimportPlayerfromdraftfast.csv_parseimportsalary_download# Create players for a classic DraftKings gameplayer_pool=[Player(name='A1',cost=5500,proj=55,pos='PG'),Player(name='A2',cost=5500,proj=55,pos='PG'),Player(name='A3',cost=5500,proj=55,pos='SG'),Player(name='A4',cost=5500,proj=55,pos='SG'),Player(name='A5',cost=5500,proj=55,pos='SF'),Player(name='A6',cost=5500,proj=55,pos='SF'),Player(name='A7',cost=5500,proj=55,pos='PF'),Player(name='A8',cost=5500,proj=55,pos='PF'),Player(name='A9',cost=5500,proj=55,pos='C'),Player(name='A10',cost=5500,proj=55,pos='C'),]roster=run(rule_set=rules.DK_NBA_RULE_SET,player_pool=player_pool,verbose=True,)# Or, alternatively, generate players from a CSVplayers=salary_download.generate_players_from_csvs(salary_file_location='./salaries.csv',game=rules.DRAFT_KINGS,)roster=run(rule_set=rules.DK_NBA_RULE_SET,player_pool=players,verbose=True,)You can see more examples in theexamplesdirectory.Game RulesOptimizing for a particular game is as easy as setting theRuleSet(see the example above). Game rules in the library are in the table below:LeagueSiteReferenceNFLDraftKingsDK_NFL_RULE_SETNFLFanDuelFD_NFL_RULE_SETNBADraftKingsDK_NBA_RULE_SETNBAFanDuelFD_NBA_RULE_SETMLBDraftKingsDK_MLB_RULE_SETMLBFanDuelFD_MLB_RULE_SETWNBADraftKingsDK_WNBA_RULE_SETWNBAFanDuelFD_WNBA_RULE_SETPGAFanDuelFD_PGA_RULE_SETNASCARFanDuelFD_NASCAR_RULE_SETSOCCERDraftKingsDK_SOCCER_RULE_SETEuroLeagueDraftKingsDK_EURO_LEAGUE_RULE_SETNHLDraftKingsDK_NHL_RULE_SETNBA PickemDraftKingsDK_NBA_PICKEM_RULE_SETNFL ShowdownDraftKingsDK_NFL_SHOWDOWN_RULE_SETNBA ShowdownDraftKingsDK_NBA_SHOWDOWN_RULE_SETMLB ShowdownDraftKingsDK_MLB_SHOWDOWN_RULE_SETNote that you can also tunedraftfastfor any game of your choice even if it's not implemented in the library (PRs welcome!). Using theRuleSetclass, you can generate your own game rules that specific number of players, salary, etc. Example:fromdraftfastimportrulesgolf_rules=rules.RuleSet(site=rules.DRAFT_KINGS,league='PGA',roster_size='6',position_limits=[['G',6,6]],salary_max=50_000,)SettingsUsage example:classShowdown(Roster):POSITION_ORDER={'M':0,'F':1,'D':2,'GK':3,}showdown_limits=[['M',0,6],['F',0,6],['D',0,6],['GK',0,6],]soccer_rules=rules.RuleSet(site=rules.DRAFT_KINGS,league='SOCCER_SHOWDOWN',roster_size=6,position_limits=showdown_limits,salary_max=50_000,general_position_limits=[],)player_pool=salary_download.generate_players_from_csvs(salary_file_location=salary_file,game=rules.DRAFT_KINGS,)roster=run(rule_set=soccer_rules,player_pool=player_pool,verbose=True,roster_gen=Showdown,)PlayerPoolSettingsmin_projmax_projmin_salarymax_salarymin_avgmax_avgOptimizerSettingsstacks- A list ofStackobjects. Example:roster=run(rule_set=rules.DK_NHL_RULE_SET,player_pool=player_pool,verbose=True,optimizer_settings=OptimizerSettings(stacks=[Stack(team='PHI',count=3),Stack(team='FLA',count=3),Stack(team='NSH',count=2),]),)LineupConstraintslocked- list of players to lockbanned- list of players to bangroups- list of player groups constraints. See belowroster=run(rule_set=rules.DK_NFL_RULE_SET,player_pool=player_pool,verbose=True,constraints=LineupConstraints(locked=['Rob Gronkowski'],banned=['Mark Ingram','Doug Martin'],groups=[[('Todd Gurley','Melvin Gordon','Christian McCaffrey'),(2,3)],[('Chris Carson','Mike Davis'),1],]))no_offense_against_defense- Do not allow offensive players to be matched up against defensive players in the optimized lineup. Currently only implemented for soccer, NHL, and NFL -- PRs welcome!CSV Uploadfromdraftfast.csv_parseimportuploadersuploader=uploaders.DraftKingsNBAUploader(pid_file='./pid_file.csv',)uploader.write_rosters(rosters)Support and ConsultingDFS optimization is only one part of a sustainable strategy. Long-term DFS winners have the best:Player projectionsBankroll managementDiversification in contests playedDiversification across lineups (seedraftfast.exposure)Research process1 hour before gametime lineup changes...and so much moreDraftFast provides support and consulting services that can help with all of these.Let's get in touch today.CreditsSpecial thanks toBen Brostoff, who authoredthis repo, which was the inspiration for this one.Current project maintainers:BenBrostoffDrew