def searchSimilar(match_id): X = oc.makeOddsOne_sf_356(match_id) Xs = np.load("odds_365.npy") for X_ in Xs: if similar(X,X_): print str(X_[6]) +' : '+ str(X_[7])+' '+res(X_[6],X_[7]) print '=========================='
def showOddsChangePre(match_id): (X_willian,y_willian) = (np.load('OddsChange0918-0926WillianHill.npy'),np.load('Res0918-0926.npy')) (X_bet365,y_bet365) = (np.load('OddsChange0918-0926Bet365.npy'),np.load('Res0918-0926Bet365.npy')) x_will = fm.makeOddsOne(match_id,'威廉希尔') x_365 = fm.makeOddsOne(match_id,'Bet365') res_will = AppOddschangePre.findSimilarOdds(X_willian,y_willian,x_will) res_365 = AppOddschangePre.findSimilarOdds(X_bet365,y_bet365,x_365) print '============== 历史变赔 ================' if res_will!=[]: print '威廉希尔 : ' + str(res_will) print str(res_will.count(1)*1.0/len(res_will))+' '+str(res_will.count(0)*1.0/len(res_will))+' '+str(res_will.count(-1)*1.0/len(res_will)) if res_365!=[]: print 'Bet365 : ' + str(res_365) print str(res_365.count(1)*1.0/len(res_365))+' '+str(res_365.count(0)*1.0/len(res_365))+' '+str(res_365.count(-1)*1.0/len(res_365)) if res_365==[] and res_will==[]: print '无相似变赔'
def test(): conn = ps.connect(database="oddsdata", user="******", password="******", host="127.0.0.1", port="5432") print 'Open successful' cur = conn.cursor() companies = ['Bet365','澳门','威廉希尔','伟德','Bwin'] companies_en = ['oddsdata_bet365','oddsdata_maqu','oddsdata_wh','oddsdata_wedd','oddsdata_bwin'] days = [(15,20),(21,26),(27,30)] for i in range(len(companies)): for day_circle in days: (day1,day2) = day_circle Lines = oc.makeDataXYtrain_forPsql(day1,day2,companies[i]) for line in Lines: print line #insertIntoOddsdata(companies_en[i],match_id,ps1,ps2,ps3,pf1,pf2,pf3,goal1,goal2,team1,team2,league,company,match_time,cur) print 'finished:'+companies[i]+' '+str(day1)+'->'+str(day2) return 0
def app_save(): conn = ps.connect(database="oddsdata", user="******", password="******", host="127.0.0.1", port="5432") print 'Open successful' cur = conn.cursor() companies = ['Bet365','澳门','威廉希尔','伟德','Bwin'] companies_en = ['oddsdata_bet365','oddsdata_maqu','oddsdata_wh','oddsdata_wedd','oddsdata_bwin'] days = [(15,17),(17,19),(19,21),(21,26),(27,30)] for i in range(len(companies)): for day_circle in days: (day1,day2) = day_circle Lines = oc.makeDataXYtrain_forPsql(day1,day2,companies[i]) filename = 'oddsdata/'+companies_en[i]+str(day1)+'-'+str(day2)+'.pkl' output = open(filename, 'wb') pickle.dump(Lines, output) output.close() # for line in Lines: # (match_id,ps1,ps2,ps3,pf1,pf2,pf3,goal1,goal2,team1,team2,league,company,match_time)=line # insertIntoOddsdata(companies_en[i],match_id,ps1,ps2,ps3,pf1,pf2,pf3,goal1,goal2,team1,team2,league,company,match_time,cur) print 'finished:'+companies[i]+' '+str(day1)+'->'+str(day2) return 0