def play(self, fields): scorelist = [self.fieldid, self.geneid] spanlist = [self.fieldid, self.geneid] p = mp.current_process() for field in fields: code = field[0] datestr = field[1] kl = self.kls[code] trader = LineTrader(kl, self.geneid) datei = kl.get_datei(datestr) if datei < self.start_datei: continue #if trader.judge_trade_goodness(datei) == False: # continue datelimit = trader.get_near_date(str(int(datestr)+1), "f") (interest, interest_rate, trade_mode_str, from_date, to_date, spent, start_price, end_price, enter_price_avg, release_price_avg, endi) = \ trader.trade(datestr, "", datelimit) scorelist.append(interest_rate) spanlist.append(spent) pid = p.pid scorefile = "%s.%s" % (SCOREFILE, str(pid)) spanfile = "%s.%s" % (SPANFILE, str(pid)) f.list2tmpfs(scorelist, scorefile) f.list2tmpfs(spanlist, spanfile)
def play(self, fields): scorelist = [self.fieldid, self.geneid] pointlist = [self.fieldid, self.geneid] spanlist = [self.fieldid, self.geneid] p = mp.current_process() for field in fields: code = field[0] datestr = field[1] trader = tr.get_trader(code, self.geneid, self.tm, self.play_style, self.trade_mode, self.expected_trade_period) (score, point, span, desc) = trader.buy_and_sell(datestr, 0, True) scorelist.append(score) pointlist.append(point) spanlist.append(span) pid = p.pid scorefile = "%s.%s" % (SCOREFILE, str(pid)) pointfile = "%s.%s" % (POINTFILE, str(pid)) spanfile = "%s.%s" % (SPANFILE, str(pid)) f.list2tmpfs(scorelist, scorefile) f.list2tmpfs(pointlist, pointfile) f.list2tmpfs(spanlist, spanfile)