else:
//更新账户
pop_list=[]
while new_amount>0:
if len(self.portfolio)>1:
for i in range(0,len(self.portfolio)):
if new_code in self.portfolio[i]:
if new_amount>self.portfolio[i][3]:
new_amount=new_amount-self.portfolio[i][3]
print(new_amount)
pop_list.append(i)
elif new_amount<self.portfolio[i][3]:
self.portfolio[i][3]=self.portfolio[i][3]-new_amount
new_amount=0
elif new_amount==self.portfolio[i][3]:
new_amount=0
pop_list.append(i)
print(pop_list)
pop_list.sort()
pop_list.reverse()
for id in pop_list:
self.portfolio.pop(id)
// 将交易记录插入历史交易记录
else:
pass
self.QA_account_calc_profit(update_message)
self.message = {