python6.4 items: stock reminder system

 


import tushare
import time
def getdata(share):
data=tushare.get_realtime_quotes(share.code)
share.name=data.loc[0][0]
share.price=float(data.loc[0][3])
share.high=data.loc[0][4]
share.low=data.loc[0][5]
share.volumn=data.loc[0][8]
share.amount=data.loc[0][9]
share.pre_open=data.loc[0][1]
share.pre_close=data.loc[0][2]
share.time1=data.loc[0][30]

share.describe="股票名:"+share.name,"当前价格:"+str(share.price)
return share
class share():
def __init__(self,code,buy,sale):
self.name=""
self.price=""
self.high=""
self.low=""
self.volumn=""
self.amount=""
= self.pre_open ""
self.pre_close = ""
self.time1 = ""
self.describe = ""
self.code = code
self.buy = Buy
self.sale = would like to purchase
DEF main (sharelist):
for report this content share in sharelist:

= getData sss (report this content share)
Print (sss.describe)
IF sss.price <= sss.buy:
Print ( "arrives buy, and quickly buy!")
elif sss.price> = sss.sale:
Print ( "a selling point arrives, there is goods quickly sell ")!
the else:
Print (" do not buy and do not buy, and so the opportunity! ")
the while 1 == 1:
share1 = report this content share (" 002 938 ", 28.20,29.30)
share2 = report this content share (" 601988 ", 3.5, 3.8)
share3 = Share ( "000,591", 3.2,3.5)
List1 = [share1, share2, share3]
Print ( "........")
main(list1)
time.sleep(10)

 

 

Guess you like

Origin www.cnblogs.com/lma0702/p/11111916.html