def showStockChart(stockcode): stockcode = stock.normalizeStockCode(stockcode) kdata = stock.getStockDayDataQianFuQuan(stockcode) if(not kdata): utils.output('股票数据不存在', 'red') return False if(stockcode[:3] != 'sh0'): weightdata = stock.getStockWeightData(stockcode) if(not weightdata): utils.output('复权数据不存在', 'red') return False #print(weightdata) #set data globals.mainwin.chart.kdata = kdata globals.mainwin.chart.stockcode = stockcode globals.mainwin.scrollbar.setMinimum(0) ktotalcount = len(kdata) globals.mainwin.scrollbar.setMaximum(ktotalcount) globals.mainwin.scrollbar.setValue(ktotalcount) globals.mainwin.scrollbar.setSingleStep(1) if(stockcode[:3] != 'sh0'): globals.mainwin.chart.weightdata = weightdata #draw globals.viewportclear = False utils.update()
def showStockChart(stockcode): stockcode = stock.normalizeStockCode(stockcode) kdata = stock.getStockDayDataQianFuQuan(stockcode) if (not kdata): utils.output('股票数据不存在', 'red') return False if (stockcode[:3] != 'sh0'): weightdata = stock.getStockWeightData(stockcode) if (not weightdata): utils.output('复权数据不存在', 'red') return False #print(weightdata) #set data globals.mainwin.chart.kdata = kdata globals.mainwin.chart.stockcode = stockcode globals.mainwin.scrollbar.setMinimum(0) ktotalcount = len(kdata) globals.mainwin.scrollbar.setMaximum(ktotalcount) globals.mainwin.scrollbar.setValue(ktotalcount) globals.mainwin.scrollbar.setSingleStep(1) if (stockcode[:3] != 'sh0'): globals.mainwin.chart.weightdata = weightdata #draw globals.viewportclear = False utils.update()
def run(subcmd, params): if(subcmd == 'show'): if(len(params) == 1): return showStockChart(params[0]) else: utils.output('请给出股票代码', 'red') utils.output(subCommands['go']) return elif(subcmd == 'clear'): globals.viewportclear = True utils.update()
def run(subcmd, params): if (subcmd == 'show'): if (len(params) == 1): return showStockChart(params[0]) else: utils.output('请给出股票代码', 'red') utils.output(subCommands['go']) return elif (subcmd == 'clear'): globals.viewportclear = True utils.update()
def run(subcmd, params): if(subcmd == 'list'): setting = {} for k in subCommands.keys(): if(k != 'list'): setting[k] = globals.__dict__.get(k) utils.output(setting) elif(subcmd == 'realtime'): if(len(params) < 1): msg = 'realtime on' globals.realtime = True utils.output(msg) elif(len(params) == 1 and (params[0]=='on' or params[0]=='off')): if(params[0]=='on'): msg = 'realtime on' globals.realtime = True else: msg = 'realtime off' globals.realtime = False utils.output(msg) else: utils.output('参数错误', 'red') utils.output(subCommands['realtime']) if(not globals.realtime): chart = globals.mainwin.chart hqinfo = chart.rt_data.get('data') if(hqinfo and chart.rt_data.get('status') == 'realtime'): chart.rt_data['status'] = '' if(chart.kdata[-1]['date'] == hqinfo['date']): chart.kdata = chart.kdata[:-1] globals.mainwin.scrollbar.setMaximum(len(chart.kdata)) utils.update()
def cbValueChanged(self, value): utils.update()