Beispiel #1
0
        "peilvfanhuanchaqujian",
        "peilvfanhuancha",
        "youshizhishu1",
        "youshizhishu2",
        "youshizhishu3",
        "youshizhishu4",
        "youshizhishu5",
        "youhuayoushi",
    ]

    # 单独元素
    arrType2 = ['shengfuqushicha', 'zonghepingjia2', 'weizhi']

    colArrs = arr1 + arr2 + arr3

    ouPeiList = DB.queryOupei(database)
    global _ouPeiMap
    for i in ouPeiList:
        _ouPeiMap[i[0]] = [i[1], i[2], i[3]]

    for k in point2Arr:
        wrap3CorrectValueRules(database, k, 2)
    for m in point3Arr:
        wrap3CorrectValueRules(database, m, 3)
    for n in point4Arr:
        wrap3CorrectValueRules(database, n, 4)
    for i in colArrs:
        wrap3CorrectValueRules(database, i)
    for j in arrType2:
        wrap1CorrectValueRules(database, j)
Beispiel #2
0
def computeByRules(database, bisaishijian, bisaishijianend):
    dictfile = open("myfile", 'rb')
    ruleMap = pickle.load(dictfile)
    minCondyz = 100
    for pk in ruleMap.keys():
        for rs in ruleMap[pk].keys():
            if ruleMap[pk][rs]['expect'] > 0:
                minCondyz = minCondyz if minCondyz <= ruleMap[pk][rs][
                    'condyz'] else ruleMap[pk][rs]['condyz']

    print(ruleMap)
    ouPeiList = DB.queryOupei(database)
    peilvMap = {}
    results = {}
    for i in ouPeiList:
        i = list(i)
        pankou = i[0]
        del i[0]
        peilvMap[pankou] = i

    forecastList = DB.queryResult(database, bisaishijian, bisaishijianend, 0,
                                  minCondyz)
    yesCount = 0
    totalCount = 0
    # 默认期望
    expect = 0

    for x in forecastList:
        j = list(x)
        lpk = j[0]
        if peilvMap[lpk] is None:
            print(("盘口为%s,找不到欧赔,跳过") % (lpk))
        if not ruleMap.__contains__(lpk):
            print("盘口为%s,找不到条件,跳过" % (lpk))
        zbf = j[1]
        kbf = j[2]
        del j[0]
        del j[0]
        del j[0]
        ctArr = j[3:6]
        j = j[:3]

        dMap = ruleMap[lpk]

        for cIndex in dMap.keys():
            if dMap[cIndex]['expect'] <= 0:
                continue
            qwyuzhi = dMap[cIndex]['expectyz'] / 100
            countYuzhi = dMap[cIndex]['condyz']
            eArr = []
            for ix in range(len(j)):
                if j[ix] * (peilvMap[lpk][ix] -
                            0.05) < qwyuzhi or ctArr[ix] < countYuzhi:
                    eArr.append(-1)
                else:
                    eArr.append(j[ix] * (peilvMap[lpk][ix] - 0.05))
            maxIndex = eArr.index(max(eArr))
            maxVal = eArr[maxIndex]
            if maxVal == 999 or maxVal == -1:
                continue
            if not results.__contains__(lpk):
                results[lpk] = [0, 0, 0]
            if cIndex == maxIndex:
                if (maxIndex == 0
                        and zbf > kbf) or (maxIndex == 1
                                           and zbf == kbf) or (maxIndex == 2
                                                               and zbf < kbf):
                    expect += peilvMap[lpk][maxIndex] - 1.05
                    yesCount += 1
                    totalCount += 1
                    results[lpk][maxIndex] += peilvMap[lpk][maxIndex] - 1.05
                else:
                    expect = expect - 1
                    totalCount += 1
                    results[lpk][maxIndex] += -1
                break

    expect = round(expect, 2)
    print(expect, totalCount, yesCount, results)
    return expect, totalCount, yesCount, results
Beispiel #3
0
def compute(database,
            bisaishijian,
            bisaishijianend,
            yuzhi=0.75,
            qwyuzhi=1.5,
            countYuzhi=5,
            limitType=-1,
            futype=-1):
    ouPeiList = DB.queryOupei(database)
    peilvMap = {}
    sxpeilv = 0.8
    results = {}
    for i in ouPeiList:
        i = list(i)
        pankou = i[0]
        del i[0]
        peilvMap[pankou] = i

    forecastList = DB.queryResult(database, bisaishijian, bisaishijianend,
                                  yuzhi, countYuzhi)
    yesCount = 0
    totalCount = 0
    # 默认期望
    expect = 0
    for j in forecastList:
        j = list(j)
        lpk = j[0]
        # if lpk not in [0,0.25,-0.25,0.5,-0.5,0.75,-0.75]:
        #     continue
        if peilvMap[lpk] is None:
            print(("盘口为%s,找不到欧赔,跳过") % (lpk))
        zbf = j[1]
        kbf = j[2]
        del j[0]
        del j[0]
        del j[0]
        #检查是否冲突
        # j[0] = -1
        # j[1] = -1
        # j[2] = -1
        ctArr = j[3:6]
        levelArr = j[6:9]
        teams = j[9:15]
        changci = j[14]
        shijian = j[15]
        # print(shijian.weekday())
        # if shijian.weekday()<4 and (bool(re.search('[A-Z]', changci[0])) or bool(re.search('[a-z]', changci[0]))):
        #     continue

        # if bool(re.search('[A-Z]', changci[0])) or bool(re.search('[a-z]', changci[0])):
        #     continue
        # print(changci)

        j = j[:3]
        eArr = []
        cNum = 0
        for ix in range(len(j)):
            if j[ix] <= yuzhi or j[ix] * (
                    peilvMap[lpk][ix] -
                    0.05) < qwyuzhi or ctArr[ix] < countYuzhi:
                eArr.append(-1)
            else:
                eArr.append(j[ix] * (peilvMap[lpk][ix] - 0.05))
                cNum += 1
        maxIndex = eArr.index(max(eArr))
        maxVal = eArr[maxIndex]

        if limitType != -1 and maxIndex != limitType:
            continue

        if limitType == 2:
            # if lpk>0.75:
            #     continue
            #
            if futype == 1 and lpk <= 0:
                continue
            elif futype == 0 and lpk > 0:
                continue
        # ctMaxIndex = levelArr.index(max(levelArr))
        # if maxIndex!=ctMaxIndex:
        #     continue
        # if cNum!=1:
        #     continue
        if maxVal == 999 or maxVal == -1:
            continue

        # if (maxIndex == 0 and pankou>=0.5) or (maxIndex==2 and pankou<=-0.5):
        #     continue
        if not results.__contains__(lpk):
            results[lpk] = [0, 0, 0]
        if maxIndex in [0, 1, 2]:
            # print(teams)
            if (maxIndex == 0
                    and zbf > kbf) or (maxIndex == 1
                                       and zbf == kbf) or (maxIndex == 2
                                                           and zbf < kbf):
                expect += peilvMap[lpk][maxIndex] - 1.05
                yesCount += 1
                totalCount += 1
                results[lpk][maxIndex] += peilvMap[lpk][maxIndex] - 1.05
            else:
                expect = expect - 1
                totalCount += 1
                results[lpk][maxIndex] += -1
        elif zbf - kbf - lpk == 0:
            continue
        elif lpk == 0:
            continue
        elif maxIndex == 3:
            cs = 1 if lpk > 0 else -1
            if (zbf - kbf - lpk) * cs == 0.25:
                expect += sxpeilv * 0.5
            elif (zbf - kbf - lpk) * cs > 0:
                expect += sxpeilv
            elif (zbf - kbf - lpk) * cs == -0.25:
                expect -= 0.5
            else:
                expect = expect - 1
        elif maxIndex == 4:
            cs = 1 if lpk > 0 else -1
            if (zbf - kbf - lpk) * cs == -0.25:
                expect += sxpeilv * 0.5
            elif (zbf - kbf - lpk) * cs < 0:
                expect += sxpeilv
            elif (zbf - kbf - lpk) * cs == 0.25:
                expect -= 0.5
            else:
                expect = expect - 1
    expect = round(expect, 2)
    # print(('时间:%s-%s,期望:%s')%(bisaishijian,bisaishijianend,expect))
    # print(results)
    return expect, totalCount, yesCount, results
Beispiel #4
0
def getPvMap(database):
    ouPeiList = DB.queryOupei(database)
    _ouPeiMap = {}
    for i in ouPeiList:
        _ouPeiMap[i[0]] = [i[1], i[2], i[3]]
    return _ouPeiMap