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