python6.4项目:股票提醒系统

 


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=sale
def main(sharelist):
for share in sharelist:

sss=getdata(share)
print(sss.describe)
if sss.price<=sss.buy:
print("到达买点,赶紧买!")
elif sss.price>=sss.sale:
print("到达卖点,有货赶紧卖!")
else:
print("别买也别买,等机会!")
while 1==1:
share1=share("002938",28.20,29.30)
share2=share("601988",3.5,3.8)
share3=share("000591",3.2,3.5)
list1=[share1,share2,share3]
print("........")
main(list1)
time.sleep(10)

 

 

转载于:https://www.cnblogs.com/lma0702/p/11111916.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值