Ejemplo n.º 1
0
def best_match_under_conditions(site, minimum_odd, bet, sport="football", date_max=None,
                                time_max=None, date_min=None, time_min=None, one_site=False,
                                live=False):
    """
    Retourne le meilleur match sur lequel miser lorsqu'on doit miser une somme
    donnée à une cote donnée. Cette somme peut-être sur seulement une issue
    (one_site=False) ou bien répartie sur plusieurs issues d'un même match
    (one_site=True), auquel cas, chacune des cotes du match doivent respecter le
    critère de cote minimale.
    """
    odds_function = get_best_odds(one_site)
    profit_function = get_profit(bet, one_site)
    criteria = lambda odds_to_check, i: ((not one_site and odds_to_check[i] >= minimum_odd)
                                         or (one_site and all(odd >= minimum_odd
                                                              for odd in odds_to_check)))
    display_function = lambda best_overall_odds, best_rank: (mises2(best_overall_odds, bet,
                                                                    best_rank, True) if not one_site
                                                             else mises(best_overall_odds, bet,
                                                                        True))
    result_function = lambda best_overall_odds, best_rank: (mises2(best_overall_odds, bet,
                                                                   best_rank, False) if not one_site
                                                            else mises(best_overall_odds, bet,
                                                                       False))
    best_match_base(odds_function, profit_function, criteria, display_function,
                    result_function, site, sport, date_max, time_max, date_min,
                    time_min, one_site=one_site)
def best_matches_combine(site,
                         minimum_odd,
                         bet,
                         sport="football",
                         nb_matches=2,
                         one_site=False,
                         date_max=None,
                         time_max=None,
                         date_min=None,
                         time_min=None,
                         minimum_odd_selection=1.01):
    """
    Retourne les meilleurs matches sur lesquels miser lorsqu'on doit miser une somme
    donnée à une cote donnée sur un combiné
    """
    all_odds = filter_dict_dates(sportsbetting.ODDS[sport], date_max, time_max,
                                 date_min, time_min)
    all_odds = filter_dict_minimum_odd(all_odds, minimum_odd_selection, site)
    sportsbetting.ALL_ODDS_COMBINE = {}
    nb_combine = binomial(len(all_odds), nb_matches)
    sportsbetting.PROGRESS = 0

    def compute_all_odds_combine(nb_combine, combine):
        sportsbetting.PROGRESS += 100 / nb_combine
        try:
            sportsbetting.ALL_ODDS_COMBINE[" / ".join([
                match[0] for match in combine
            ])] = cotes_combine_all_sites(*[match[1] for match in combine])
        except KeyError:
            pass

    ThreadPool(4).map(lambda x: compute_all_odds_combine(nb_combine, x),
                      combinations(all_odds.items(), nb_matches))
    sportsbetting.PROGRESS = 0
    odds_function = get_best_odds(one_site)
    profit_function = get_profit(bet, one_site)
    criteria = lambda odds_to_check, i: (
        (not one_site and odds_to_check[i] >= minimum_odd) or
        (one_site and all(odd >= minimum_odd for odd in odds_to_check)))
    display_function = lambda best_overall_odds, best_rank: (
        mises2(best_overall_odds, bet, best_rank, True)
        if not one_site else mises(best_overall_odds, bet, True))
    result_function = lambda best_overall_odds, best_rank: (
        mises2(best_overall_odds, bet, best_rank, False)
        if not one_site else mises(best_overall_odds, bet, False))
    best_match_base(odds_function,
                    profit_function,
                    criteria,
                    display_function,
                    result_function,
                    site,
                    sport,
                    date_max,
                    time_max,
                    date_min,
                    time_min,
                    True,
                    nb_matches,
                    one_site=one_site,
                    combine_opt=True)
Ejemplo n.º 3
0
def best_match_cotes_boostees(site, gain_max, sport="football", date_max=None, time_max=None,
                              date_min=None, time_min=None):
    odds_function = get_best_odds(True)
    profit_function = lambda odds_to_check, i: gain_gains_nets_boostes(odds_to_check, gain_max,
                                                                       False)
    criteria = lambda odds_to_check, i: odds_to_check[i] >= 1.5
    display_function = lambda odds_to_check, i: mises_gains_nets_boostes(odds_to_check, gain_max,
                                                                         False, True)
    result_function = lambda odds_to_check, i: mises_gains_nets_boostes(odds_to_check, gain_max,
                                                                        False, False)
    best_match_base(odds_function, profit_function, criteria, display_function, result_function,
                    site, sport, date_max, time_max, date_min, time_min)
Ejemplo n.º 4
0
def best_match_gain_cote(site, bet, sport="football", date_max=None, time_max=None, date_min=None,
                         time_min=None):
    """
    Retourne le match sur lequel miser pour optimiser une promotion du type "gain de la cote gagnée"
    """
    odds_function = get_best_odds(False)
    profit_function = lambda odds_to_check, i: gain_promo_gain_cote(odds_to_check, bet, i)
    criteria = lambda odds_to_check, i: True
    display_function = lambda best_overall_odds, best_rank: mises_promo_gain_cote(best_overall_odds,
                                                                                  bet, best_rank,
                                                                                  True)
    result_function = lambda best_overall_odds, best_rank: mises_promo_gain_cote(best_overall_odds,
                                                                                 bet, best_rank,
                                                                                 False)
    best_match_base(odds_function, profit_function, criteria, display_function, result_function,
                    site, sport, date_max, time_max, date_min, time_min)
Ejemplo n.º 5
0
def best_match_defi_rembourse_ou_gagnant(site,
                                         minimum_odd,
                                         stake,
                                         sport,
                                         date_max=None,
                                         time_max=None,
                                         date_min=None,
                                         time_min=None):
    odds_function = get_best_odds(False)
    profit_function = lambda best_overall_odds, best_rank: gain_defi_rembourse_ou_gagnant(
        best_overall_odds, stake, best_rank, True)
    profit_function = lambda odds_to_check, i: gain_defi_rembourse_ou_gagnant(
        odds_to_check, stake, i)
    criteria = lambda odds_to_check, i: odds_to_check[i] >= minimum_odd
    display_function = lambda best_overall_odds, best_rank: mises_defi_rembourse_ou_gagnant(
        best_overall_odds, stake, best_rank, True)
    result_function = lambda best_overall_odds, best_rank: mises_defi_rembourse_ou_gagnant(
        best_overall_odds, stake, best_rank, False)
    best_match_base(odds_function, profit_function, criteria, display_function,
                    result_function, site, sport, date_max, time_max, date_min,
                    time_min)
Ejemplo n.º 6
0
def best_matches_combine2(site,
                          minimum_odd,
                          bet,
                          sport,
                          minimum_odd_selection,
                          date_max=None,
                          time_max=None,
                          date_min=None,
                          time_min=None):
    nb_matches = 2
    all_odds = filter_dict_dates(sb.ODDS[sport], date_max, time_max, date_min,
                                 time_min)
    all_odds = filter_dict_minimum_odd(all_odds, minimum_odd_selection, site)
    odds_combine_opt = [{} for _ in range(6)]
    nb_combine = binomial(len(all_odds), nb_matches)
    sb.PROGRESS = 0
    combis = cotes_combine_optimise([[1 for _ in range(3)]
                                     for i in range(nb_matches)])[1]
    print(combis)

    def compute_all_odds_combine_optimise(nb_combine, combine,
                                          odds_combine_opt):
        sb.PROGRESS += 100 / nb_combine
        try:
            cotes_combination = cotes_combine_reduit_all_sites(
                *[match[1] for match in combine])
            for i in range(6):
                odds_combine_opt[i][" / ".join([match[0] for match in combine
                                                ])] = cotes_combination[i]


#                 combis[i] = cotes_combination[i][1]
        except KeyError:
            pass

    ThreadPool(4).map(
        lambda x: compute_all_odds_combine_optimise(nb_combine, x,
                                                    odds_combine_opt),
        combinations(all_odds.items(), nb_matches))
    sb.PROGRESS = 0
    odds_function = get_best_odds(False)
    profit_function = get_profit(bet, False)
    criteria = lambda odds_to_check, i: all(odd >= minimum_odd
                                            for odd in odds_to_check)
    for i, combination in enumerate(combis):
        sb.ALL_ODDS_COMBINE = odds_combine_opt[i]
        #         display_function = lambda odds_to_check, i: mises_combine_optimise(odds_to_check, combination, bet, minimum_odd, True)
        #         result_function = lambda odds_to_check, i: mises_combine_optimise(odds_to_check, combination, bet, minimum_odd, False)
        display_function = lambda best_overall_odds, best_rank: mises2(
            best_overall_odds, bet, best_rank, True)
        result_function = lambda best_overall_odds, best_rank: mises2(
            best_overall_odds, bet, best_rank, False)
        best_match_base(odds_function,
                        profit_function,
                        criteria,
                        display_function,
                        result_function,
                        site,
                        sport,
                        date_max,
                        time_max,
                        date_min,
                        time_min,
                        True,
                        nb_matches,
                        combine_opt=True)