if(i.haveorno == 1): tmp += i.number*i.buyprice*50 roi = (tmp + my_porfolio.money_canbuy + my_porfolio.output_money + my_porfolio.money_deposit)/my_porfolio.total_output_money return roi def TheEed(): ##==== !!!!problem!!!! ====## print ROI() sys.exit() ## start code here ## my_porfolio = porfolio(transation_Time) my_test_result = test_result() #my_txff = txff(train_data_feature_few_day) my_txff = txff(0) f=open('../../option_roi_result.csv','w') f.write("date,roi\n") buyfilelist = open('../../buyfilelist.csv','w') buyfilelist.write("buy_or_sell,day,strike_price,number,id,PutorCall,buyprice,output_money,money_canbuy\n") sellfilelist = open('../../sellfilelist.csv','w') sellfilelist.write("buy_or_sell,sellday,id,number,buyday,buyprice,sellprice\n") my_option = list(csv.DictReader(open('../../totaloption.csv','r'))) ##==== Enter Train Test START and End Day ====## StartDayi = 0 EndDayi = 0
roi = (tmp + my_porfolio.money_canbuy + my_porfolio.output_money + my_porfolio.money_deposit) / my_porfolio.total_output_money return roi def TheEed(): ##==== !!!!problem!!!! ====## print ROI() sys.exit() ## start code here ## my_porfolio = porfolio(transation_Time) my_test_result = test_result() my_txff = txff(train_data_feature_few_day) f = open('option_roi_result.csv', 'w') f.write("date,roi\n") #csv.DictReader(open('./totaloption.csv','r')) = csv.DictReader(open('./totaloption.csv','r')) ##==== start roi ====## which = 0 for i in range(0, len(my_test_result.label), 1): ##==== to count how many days ====# for tra in iter(my_porfolio.transation_list): if (tra.haveorno == 1): tra.howmanyday += 1 ##==== if label != 0 ====## if (my_test_result.label[i] != 0):