def profit(self,start,end,code):
start_price=ts.get_k_data(start=start,end=start,code=code)
if len(start_price)==0:
print "Not open for start day"
#?????????????????.
s_price=start_price['close'].values[0]
print "Start price: ",s_price
end_price=ts.get_k_data(start=end,end=end,code=code)
if len(end_price)==0:
print "Not open for end day"
e_price=end_price['close'].values[0]
print "End price: ",e_price
earn_profit=(e_price-s_price)/s_price*100
print "Profit: ",
print round(earn_profit,2)
评论列表
文章目录