看盘工具

from tkinter import *
import urllib.request
from PIL import Image, ImageTk
import os,io,threading,time
from tkinter import messagebox
win=Tk()
win.title(‘疯陈编程-看盘‘)
win.geometry(‘1270x800+200+100‘)
#win.attributes("-toolwindow", 1)
win.resizable(width=False,height=False)

f1 = LabelFrame(win,text=‘上证日线图‘)
f1.grid(row=0,column=0,padx=10,pady=10)

f2 = LabelFrame(win,text=‘上证分时图‘)
f2.grid(row=0,column=1,padx=10,pady=10)

f3 = LabelFrame(win,text=‘个股日线图‘)
f3.grid(row=1,column=0,padx=10,pady=10)

f4 = LabelFrame(win,text=‘个股分时图‘)
f4.grid(row=1,column=1,padx=10,pady=10)

f5 = LabelFrame(win,text=‘股票查询操作‘)
f5.grid(row=2,column=0,columnspan=2,padx=10,pady=10)

f6 = LabelFrame(win,text=‘盘口数据‘)
f6.grid(row=1,column=1,rowspan=3,padx=10,pady=10)

netDateUrl = ‘http://hq.sinajs.cn/list=sz000078‘

#获取股票数据当日数据
def getStockDate(netDateUrl):
    html = urllib.request.urlopen(netDateUrl).read()
    html = html.decode(‘gbk‘)
    stock_dict={}
    stock_dict[‘code‘] = html[13:19]
    temp = html[21:246].split(‘,‘)
    stock_dict[‘name‘] = temp[0]
    stock_dict[‘open‘] = temp[1]
    stock_dict[‘close‘] = temp[2]
    stock_dict[‘trade‘] = temp[3]
    stock_dict[‘high‘] = temp[4]
    stock_dict[‘low‘] = temp[5]
    stock_dict[‘buy‘] = temp[6]
    stock_dict[‘sell‘] = temp[7]
    stock_dict[‘volume‘] = str(int(temp[8])//100)+‘手‘
    stock_dict[‘money‘] = str(float(temp[9])//10000)+‘万‘
    stock_dict[‘buy1vol‘] = temp[10]
    stock_dict[‘buy1pri‘] = temp[11]
    stock_dict[‘buy2vol‘] = temp[12]
    stock_dict[‘buy2pri‘] = temp[13]
    stock_dict[‘buy3vol‘] = temp[14]
    stock_dict[‘buy3pri‘] = temp[15]
    stock_dict[‘buy4vol‘] = temp[16]
    stock_dict[‘buy4pri‘] = temp[17]
    stock_dict[‘buy5vol‘] = temp[18]
    stock_dict[‘buy5pri‘] = temp[19]
    stock_dict[‘sell1vol‘] = temp[20]
    stock_dict[‘sell1pri‘] = temp[21]
    stock_dict[‘sell2vol‘] = temp[22]
    stock_dict[‘sell2pri‘] = temp[23]
    stock_dict[‘sell3vol‘] = temp[24]
    stock_dict[‘sell3pri‘] = temp[25]
    stock_dict[‘sell4vol‘] = temp[26]
    stock_dict[‘sell4pri‘] = temp[27]
    stock_dict[‘sell5vol‘] = temp[28]
    stock_dict[‘sell5pri‘] = temp[29]
    stock_dict[‘data‘] = temp[30]
    stock_dict[‘time‘] = temp[31]

    return stock_dict
#获取图片对象
def getImage(code,imtype):
    if imtype==‘d‘:
        if code[0]==‘6‘ or code==‘000001‘:
            url = ‘http://image.sinajs.cn/newchart/daily/n/sh‘+code+‘.gif‘
        else:
            url = ‘http://image.sinajs.cn/newchart/daily/n/sz‘+code+‘.gif‘
        image_bytes = urllib.request.urlopen(url).read()
        data_stream = io.BytesIO(image_bytes)
        pil_image = Image.open(data_stream)
        tk_image = ImageTk.PhotoImage(pil_image)
        return tk_image
    else:
        if code[0]==‘6‘ or code==‘000001‘:
            url = ‘http://image.sinajs.cn/newchart/min/n/sh‘+code+‘.gif‘
        else:
            url = ‘http://image.sinajs.cn/newchart/min/n/sz‘+code+‘.gif‘
        image_bytes = urllib.request.urlopen(url).read()
        data_stream = io.BytesIO(image_bytes)
        pil_image = Image.open(data_stream)
        tk_image = ImageTk.PhotoImage(pil_image)
        return tk_image

#获取上证日线图
tk_image_shday = getImage(‘000001‘,imtype=‘d‘)
L1 = Label(f1, image=tk_image_shday)
L1.grid(padx=5, pady=5)
#获取上证分时图
tk_image_min_shshi = getImage(‘000001‘,imtype=‘m‘)
L2 = Label(f2, image=tk_image_min_shshi)
L2.grid(padx=5, pady=5) 

#获取股票日线图
tk_image_day = getImage(‘000078‘,imtype=‘d‘)
L3 = Label(f3, image=tk_image_day)
L3.grid(padx=5, pady=5)
#获取股票分时图
tk_image_min = getImage(‘000078‘,imtype=‘d‘)
L4 = Label(f4, image=tk_image_min)
L4.grid(padx=5, pady=5) 

var=StringVar()
var.set(‘‘)
Entry(f5,textvariable=var,width=20).grid(row=0,column=5,padx=10,pady=10)

def fun():
    code = var.get()
    if len(code)!=6:
        messagebox.showinfo(‘错误‘,‘请输入正确的股票代码!‘)
        return
    global L4,L3
    global im3,im4
    im3 = getImage(code,imtype=‘d‘)
    im4 = getImage(code,imtype=‘m‘)
    L3.config(image=im3)
    L4.config(image=im4)
    L3.update()

def fun2():
    p = threading.Thread(target = fun)
    p.setDaemon(True)#守护进程
    p.start()

Button(f5,text=‘上证指数‘).grid(row=0,column=0,padx=10,pady=10)
Button(f5,text=‘深证指数‘).grid(row=0,column=1,padx=10,pady=10)
Button(f5,text=‘中小板指数‘).grid(row=0,column=2,padx=10,pady=10)
Button(f5,text=‘创业板指数‘).grid(row=0,column=3,padx=10,pady=10)
Button(f5,text=‘数据同步‘).grid(row=0,column=4,padx=10,pady=10)

Button(f5,text=‘查询股票‘,command=fun).grid(row=0,column=6,padx=10,pady=10)
Button(f5,text=‘停止刷新‘).grid(row=0,column=7,padx=10,pady=10)
Button(f5,text=‘退出程序‘).grid(row=0,column=8,padx=10,pady=10)
win.mainloop()

  

原文地址:https://www.cnblogs.com/wumac/p/11982162.html

时间: 2024-08-02 05:27:48

看盘工具的相关文章

7. 炒股怎么看盘

1. 如何看盘 先看大盘表现,据统计95%的股票是能够随着大盘的波动而波动(大盘涨,95%股票涨,大盘跌,95%股票跌) 大盘指数是反应整个市场强弱走势的指标,所以看大盘做个股非常重要 2. 看盘的思路 看板块排名,看当天那个板块表现最强,那个板块表现最弱,关注市场资金集中在那些板块炒作. 3. 分析盘面的技术方法 大盘涨,同时大部分比例股票都上涨,市场才是真涨. 大盘跌,同时大部分比例股票下跌,市场才是真跌. 看周边市场是看全球重要国家的股票指数表现.优于经济全球化,全球的行情联动也越来越紧密

看盘-看盘顺序

看盘-看盘顺序 1.大盘 开盘点位 高开,低开 重大消息 2.板块 是否有热门板块 3.涨跌幅榜 观察哪些股票涨跌幅靠前 4.个股走势 盘口,分时走势,K线走势 原文地址:https://www.cnblogs.com/wangwangfei/p/12114448.html

百度云 百度网盘超级会员账号SVIP账号 永久免费分享 附常见的不限速网盘工具

加入组织 说实在的,免费更新了将近一年了,起初是因为自己经常要下东西,所以顺便更新一下,没想到这么多人关注. 现在自己也有半年没用过网盘了,更新的也慢了,账号失效的也快了. 那么我本身也有弄淘宝京东优惠这方面的,大家可以进这个群,以后账号在群里更新.这样呢,更新起来也有动力. 说实话这种吃力不讨好还免费的东西确实挺难坚持的. 同样也不强迫大家必须加,情况就是这么个情况,群里会分享一些淘宝京东的bug,主要还是买东西比较优惠. 账号呢每天在群里5点半更新(也会更新其他各大平台账号 包括: 迅雷 腾

利用FbinstTool+大白菜u盘工具,制作多系统启动U盘【转】

一般制作多系统启动盘的教程都会要用到rub4dos+grubinst+ultraiso+msgdiyerl等等工具,一大串的工具列表让人望而生畏.其实大白菜里已经对这些工具做了非常好的封装,利用大白菜+FbinstTool,我们就可以方便的制作出功能丰富的启动U盘. 一.准备工作 1.足够大的U盘一个(我用的是Kingston 8GB U盘,就本文来说2G就够了) 2.大白菜4.6 3.FbinstTool 4.Ubuntu和CDLinux的live CD 二.制作过程 1.打开大白菜4.6,点

如何制作一个通用的多系统安装U盘(工具介绍)

我在北京中关村的一家以服务器,存储为主要产品的公司供职售前职位.公司的售后部门经常要给客户安装系统和存储.安装系统传统的方式就是通过光驱,而光驱和光盘因为种种原因经常出现各种问题而无法安装系统.比如光盘划伤,光驱的读盘纠错能力差等. 为了解决这个问题,我开始尝试用U盘来安装各种系统(Linux,Windows,Vmware),最重要的是能把各种操作系统的安装集成在一个U盘中.首先要解决的问题是如何引导U盘,经过选型,最终确定了两种引导加载程序.Syslinux和Grub4dos.另外,还有两个虚

0910南方看盘分析:资金快速回流,大涨如期而至

建国钞(散)开放再托管的消息还在发酵,价格再遭打压,跌停价收盘,报1300.1.买方仍在努力尝试扭转局面,全天成交额再次超过千万,实际成交量较昨天有所增多.日内跌停板曾被打开,但抛盘的压力依然巨大,后市极可能继续承压下跌.建国钞(百连)则稳步上涨,以涨停价收盘,报1273.6,与建国钞(散)的价格差距已大幅度缩小,明日有望重新超越.钱网认为,价格最终回归理性是必然的,市场终究会自发的修正价格,出现目前的情况也印证了这一点.以此为据,建国钞(百连)在强烈的上涨需求下后市恐将继续走高,而建国钞(散)

就恢复健康法就回家看过工具

http://www.see2know.com/Learn/Guide/1247181.html http://www.see2know.com/Learn/Guide/1247152.html http://www.see2know.com/Learn/Guide/1247123.html http://www.see2know.com/Learn/Guide/1247101.html http://www.see2know.com/Learn/Guide/1247084.html http:

谷歌免费极速看图工具Picasa 3.9.140.239

http://www.epanel.com.cn/epanelweb/surveycommunity/questionindex.htm?lifeid=441029 http://www.epanel.com.cn/epanelweb/surveycommunity/questionindex.htm?lifeid=441008 http://www.epanel.com.cn/epanelweb/surveycommunity/questionindex.htm?lifeid=440981 h

Feodra U盘安装制作U盘工具 必不可少

http://doc.fedoraproject.org/en-US/Fedora/20/html/Installation_Guide/Making_USB_Media.html#Making_USB_Media-Windows