示例#1
0
def test_banned_players():
    players = _generate_test_player_data()

    optimized = optimize(players,
                         player_settings=PlayerPoolSettings(),
                         constraints=LineupConstraints(banned=['A', 'C']))
    ntools.assert_equal(optimized.total, 49 + 47 + 46 + 44 + 42 + 40)
示例#2
0
def test_locked_players():
    players = _generate_test_player_data()

    optimized = optimize(players,
                         constraints=LineupConstraints(locked=['B', 'D']))
    ntools.assert_equal(optimized.total, 49 + 47 + 46 + 44 + 42 + 40)
示例#3
0
def test_default_lineup():
    players = _generate_test_player_data()
    optimized = optimize(players)
    ntools.assert_equal(optimized.total, 50 + 48 + 46 + 44 + 42 + 40)
示例#4
0
import os
import random
from draftfast.pickem.pickem_optimize import optimize
from draftfast.csv_parse import uploaders, salary_download
from draftfast import rules
from draftfast.lineup_constraints import LineupConstraints

salary_file_location = os.environ.get('PICKEM')
pid_file_location = os.environ.get('PICKEM_PIDS')

players = salary_download.generate_players_from_csvs(
    game=rules.DRAFT_KINGS,
    salary_file_location=salary_file_location,
    ruleset=rules.DK_NBA_PICKEM_RULE_SET,
)

rosters = []
for p in range(20):
    player = random.choice(players)
    roster = optimize(
        all_players=players,
        constraints=LineupConstraints(locked=[p.name]),
    )
    rosters.append(roster)

uploader = uploaders.DraftKingsNBAPickemUploader(pid_file=pid_file_location, )

uploader.write_rosters(rosters)
示例#5
0
def test_locked_players():
    players = _generate_test_player_data()
    pickem_settings = PickemSettings(locked=['B', 'D'])
    optimized = optimize(players, pickem_settings=pickem_settings)
    ntools.assert_equal(optimized.total, 49 + 47 + 46 + 44 + 42 + 40)
示例#6
0
def test_banned_players():
    players = _generate_test_player_data()
    player_settings = PlayerPoolSettings(banned=['A', 'C'], )
    optimized = optimize(players, player_settings=player_settings)
    ntools.assert_equal(optimized.total, 49 + 47 + 46 + 44 + 42 + 40)
示例#7
0
from draftfast.pickem.pickem_command_line import get_args
from draftfast.pickem.pickem_optimize import optimize, get_all_players

if __name__ == '__main__':
    args = get_args()
    all_players = get_all_players(
        args.salary_file,
        args.projection_file,
        args.use_averages,
    )
    print(optimize(all_players, args))