def run(configFile): print("Reading from configurations at " + configFile) configs = readConfigurations(configFile) sys.path.append('./src/Models') print("Generating results for " + str(configs['monotonic_indices'])) cmd = "python3 src/Verification_framework.py " + configFile print("The command to run is %s" % (cmd)) p = subprocess.Popen(cmd, stderr=subprocess.PIPE, shell=True) (output, err) = p.communicate() p_status = p.wait() print("Finished verifying") if configs['is_classification']: task_type = {configs['name']: "classification"} else: task_type = {configs['name']: "regression"} analysis(configs['run_data_path'] + configs['name'] + "/", [configs['name']], "train", task_type) print("You can find the best counterexample trained model here : " + configs['run_data_path'] + configs['name'])
def Submission_Task(self): """ 提交任务订单 """ self.driver.implicitly_wait(180) self.driver.execute() logging.info(self.deviceid + u'-获取二维码') logging.info(self.deviceid + u'-正在解析二维码') url = analysis().get(self.deviceid) token = TokenYZ.pdtoken() logging.info(self.deviceid + u'-二维码解析地址:%s' % url) if self.phmode == '3.火箭API'.decode("utf-8"): self.taskid = submissionorder().submission_hj(url, self.phonenumber[0], token, '360', self.phonenumber[1]) else: self.taskid = submissionorder().submission(url, self.phonenumber[0], token, '360') logging.info(self.deviceid + u'-订单提交成功') logging.info(self.deviceid + u'-订单号:' + self.taskid) self.driver.implicitly_wait(5)
def Submission_Task(self): """ 提交任务订单 """ self.visualization('获取二维码') logging.info(self.deviceid + u'-获取二维码') self.visualization('正在解析二维码') logging.info(self.deviceid + u'-正在解析二维码') token = TokenYZ.pdtoken() url = analysis().get(self.deviceid) self.visualization('二维码解析地址:%s' % url) logging.info(self.deviceid + u'-二维码解析地址:%s' % url) if self.phmode == '3.火箭API'.decode("utf-8"): self.taskid = submissionorder().submission_hj( url, self.phonenumber[0], token, '360', self.phonenumber[1]) else: self.taskid = submissionorder().submission(url, self.phonenumber[0], token, '360') self.visualization('订单提交成功') self.visualization('订单号:%s' % self.taskid) logging.info(self.deviceid + u'-订单提交成功') logging.info(self.deviceid + u'-订单号:' + self.taskid)
cardsAlreadyPlayed = [] firstCardHand = card.randomGenerate(cardsAlreadyPlayed) cardsAlreadyPlayed.append(firstCardHand) secondCardHand = card.randomGenerate(cardsAlreadyPlayed) cardsAlreadyPlayed.append(secondCardHand) myHand = (firstCardHand, secondCardHand) print("My hand is: ") for card in myHand: print(card) anal = analysis(myHand) anal.preflop(myHand) anal.showOdds() communityCards = [] for i in range(0, 3): shownCard = card.randomGenerate(cardsAlreadyPlayed) cardsAlreadyPlayed.append(shownCard) communityCards.append(shownCard) print("\nThe Flop is: ") for card in communityCards: print(card)
# data = analysis(limit=30, trade_volume=True, stop_loss="trade_volume", scale_down_trade_vol_par=0.82) # 总结对比目前最好的策略。 total_data = pd.DataFrame() stock_amount = [] strategy_name = [] cagr = [] sharpe = [] volatility = [] max_drawdown = [] avg_drawdown = [] avg_drawdown_days = [] for strategy in ["小市值", "反转+小市值", "反转+小市值+止损"]: for i in range(5, 151, 5): if strategy == "小市值": data = analysis(loser=False, limit=i) elif strategy == "反转+小市值": data = analysis(limit=i) elif strategy == "反转+小市值+止损": data = analysis(limit=i, trade_volume=True, stop_loss="trade_volume", scale_down_trade_vol_par=0.82) performance = data["Equity with Transaction Cost"].calc_stats() stock_amount.append(i) strategy_name.append(strategy) cagr.append(performance.cagr) sharpe.append(performance.daily_sharpe) volatility.append(performance.daily_vol) max_drawdown.append(-performance.max_drawdown) avg_drawdown.append(-performance.avg_drawdown) avg_drawdown_days.append(performance.avg_drawdown_days) total_data["股票数量"] = stock_amount total_data["策略"] = strategy_name
try: incomingPhone = p.recv(1024) except Exception: pos_connection.send("0") print incomingPOS, " ----- ", incomingPhone # print "nay" # print incomingPhone if incomingPhone is None: pos_connection.send("0") print incomingPOS, " ----- ", incomingPhone # print "nay" else: if analysis(incomingPOS, incomingPhone): pos_connection.send("1") print get_balance(openbank) transact("1000", openbank) print get_balance(openbank) # print "yay" else: pos_connection.send("0") print incomingPOS, " ----- ", incomingPhone # print "nay" except Exception: pos_connection.send("0") print incomingPOS, " ----- ", incomingPhone