def pt(id): global GP_CATCH_DIC,GP_PT_DIC,GP_PT_TIP_U_LIST,GP_PT_TIP_D_LIST,FIRST_INIT data = GP_CATCH_DIC[id] _o = data.get('list', []) _ocur = float(_o[3]) # 当前价格 # 停牌 if _ocur == 0: return # 没有数据 if id not in GP_PT_DIC.keys(): return ptdata = GP_PT_DIC.get(id,{}) # 向上 if id not in GP_PT_TIP_U_LIST: hightip = ptdata['high'] * 1.1 if _ocur > hightip: GP_PT_TIP_U_LIST.append(id) if FIRST_INIT != 1: s = '[平台][' + _o[31] + '] ' + data['name'] + ' ' + id + ' 向上平台突破' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) # 向下 if id not in GP_PT_TIP_D_LIST: downtip = ptdata['low'] * 0.9 if _ocur < downtip: GP_PT_TIP_D_LIST.append(id) if FIRST_INIT != 1: s = '[平台][' + _o[31] + '] ' + data['name'] + ' ' + id + ' 向下平台突破' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s)
def xg(id): global GP_CATCH_DIC,GP_XG_DIC,GP_XG_TIP_DIC,FIRST_INIT data = GP_CATCH_DIC[id] _o = data.get('list',[]) _omax = float(_o[4]) # 今日最高价 #没有数据 if id not in GP_XG_DIC.keys(): return xgdata = GP_XG_DIC.get(id,{}) maxkey = 0 for key, value in xgdata.items(): if _omax > value and value != 0: maxkey = getmax(maxkey,key) maxkey = int(maxkey) if maxkey == 0 or maxkey == 10 or maxkey == 20: return if id not in GP_XG_TIP_DIC: GP_XG_TIP_DIC[id] = {} maxkey = str(maxkey) if maxkey not in GP_XG_TIP_DIC[id]: GP_XG_TIP_DIC[id][maxkey] = 1 if FIRST_INIT != 1: s = '[新高][' + _o[31] + '] ' + data['name'] + ' ' + id + ' ' + maxkey + '日新高' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s)
def kplje(): global KPL_RUL param = {} param['a'] = 'KanPanNew' param['c'] = 'YiDongKanPan' param['Index'] = '0' param['Order'] = '9' param['st'] = '24' param['Token'] = '5905a7ec37fa0f49a74b8bcef802cea7' param['UserID'] = '228432' res = net.sendpost(KPL_RUL,param) if res != -1: try: data = json.loads(res) except Exception as ee: print("json error") return -1 global KPL_ZLJE_LIST,FIRST_INIT for row in data['List']: code = row['stock_code'] if code in KPL_ZLJE_LIST: continue ZJJE = row['ZJJE'] jz = Decimal(ZJJE / 100000000).quantize(Decimal('0.00')) jz = '{:g}'.format(float(jz)) jz = float(jz) if jz > 2: if FIRST_INIT != 1: s = '[主力净额][' + time.strftime("%H:%M:%S", time.localtime()) + '] ' + row['stock_name'] + ' ' + code + ' 本日净流入' + str(jz) + '亿' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) KPL_ZLJE_LIST.append(code)
def ths(condition): res = thsdata(condition) if res != -1: global FIRST_INIT for row in res: id = row[0].split('.')[0] if id in THS_TIP_DIC: continue if FIRST_INIT != 1: jz = Decimal(row[4] / 100000000).quantize(Decimal('0.00')) jz = '{:g}'.format(float(jz)) jz = float(jz) s = '[净额][' + time.strftime("%H:%M:%S", time.localtime()) + '] ' + row[1] + ' ' + id + ' 两小时净流入' + str(jz) + '亿' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) THS_TIP_DIC.append(id)
def sc(id): global GP_CATCH_DIC, GP_SC_TIP_DIC, FIRST_INIT if id in GP_SC_TIP_DIC: return data = GP_CATCH_DIC[id] _o = data['list'] _omax = float(_o[4]) #今日最高价 _ozs = float(data['ed']) #昨日收盘价 _ztj = Decimal(_ozs * 1.03).quantize(Decimal('0.00')) _ztj = '{:g}'.format(float(_ztj)) _ztj = float(_ztj) if _omax >= _ztj: GP_SC_TIP_DIC.append(id) if FIRST_INIT != 1: s = '[涨幅][' + _o[31] + '] ' + data['name'] + ' ' + id + ' 首次涨幅到3%' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s)
def ks(id): global GP_CATCH_DIC,FIRST_INIT data = GP_CATCH_DIC[id] _o = data['list'] _olast = data['last'] # 上次价格 _ocur = float(_o[3]) # 当前价格 _olast.append(_ocur) llen = len(_olast) if llen < 5: GP_CATCH_DIC[id]['last'] = _olast return elif llen > 10: del _olast[0] GP_CATCH_DIC[id]['last'] = _olast lmin = min(_olast) if lmin <= 0: print('lmin<=0 id:'+ id) print(_olast) return lks = int((_ocur - lmin) / lmin * 100) if lks > 3: if FIRST_INIT != 1: GP_CATCH_DIC[id]['last'] = [] GP_CATCH_DIC[id]['last'].append(float(_ocur)) s = '[拉升][' + _o[31] + '] ' + data['name'] + ' ' + id + ' 快速拉升涨超过' + str(lks) + '%' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) return lmax = max(_olast) if _ocur <= 0: print('_ocur<=0 id:' + id) print(_olast) return ldks = int((lmax - _ocur) / _ocur * 100) if ldks > 3: if FIRST_INIT != 1: GP_CATCH_DIC[id]['last'] = [] GP_CATCH_DIC[id]['last'].append(float(_ocur)) s = '[跳水][' + _o[31] + '] ' + data['name'] + ' ' + id + ' 快速跳水超过' + str(ldks) + '%' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) return
def kpl(): global KPL_RUL param = {} param['a'] = 'GetPointPlate' param['c'] = 'PCArrangeData' param['Index'] = '0' param['PointType'] = '1,2,3' param['st'] = '1' #param['Date'] = '2018-07-30'#time.strftime("%Y-%m-%d", time.localtime())# param['Token'] = '5905a7ec37fa0f49a74b8bcef802cea7' param['UserID'] = '228432' res = net.sendpost(KPL_RUL,param) if res != -1: global KPL_CATCH_LIST,FIRST_INIT try: data = json.loads(res) except Exception as ee: print("json error") return -1 for row in data['content']['List']: tid = row['Time'] if tid in KPL_CATCH_LIST: continue KPL_CATCH_LIST.append(tid) comment = row['Comment'] stock = row['Stock'] for stk in stock: name = stk[1] tip = '[' + name + ',' + stk[0] + ',' + str(stk[2]) + '%]' comment = comment.replace(name,tip) if FIRST_INIT != 1: time_local = time.localtime(tid) stime = time.strftime("%H:%M:%S", time_local) s = '[开盘啦][' + stime + '] ' + comment qq.senMsgToBuddy(s) qq.sendMsgToGroup(s)
def zd(id): global GP_CATCH_DIC,GP_CZT_LIST,FIRST_INIT,GP_LB_LIST#GP_CHECK_ZT_LIST,GP_DT_CNT,GP_ZT_CNT,GP_ZT_LIST #提醒次数过多 #if (id in GP_ZT_CNT.keys() and GP_ZT_CNT[id] > 4) or (id in GP_DT_CNT.keys() and GP_DT_CNT[id] > 4): # return data = GP_CATCH_DIC[id] _o = data['list']#[-1] _ozsp = float(data.get('ed', 0)) #昨日收盘价格 _ocur = float(_o[3]) #当前价格 _open = float(data.get('s', 0)) #开盘价 _otime = _o[31] #时间 _ost = data.get('st',False) #是否st _oname = data.get('name','') #名字 #停盘 或 平盘 if _ozsp == _ocur: return #涨停 if _ost: _corl = 1.05 else: _corl = 1.1 _ztj = Decimal(_ozsp * _corl).quantize(Decimal('0.00')) _ztj = '{:g}'.format(float(_ztj)) _ztj = float(_ztj) #_ztj = round(_ozsp * _corl,2) if _ztj == _ocur: #新增涨停板 if id not in GP_CZT_LIST: if FIRST_INIT != 1: if _open == _ocur: s = '[竞价][' + _otime + '] ' + _oname + ' ' + id + ' 竞价涨停' #timeArray = _otime.split(':') #if int(timeArray[0]) == 9 and int(timeArray[1]) < 30: #else: # s = '[涨停][' + _otime + '] ' + data['name'] + ' ' + id + ' 冲击涨停' else: s = '[涨停][' + _otime + '] ' + _oname + ' ' + id + ' 冲击涨停' if id in GP_LB_LIST.keys(): s = s + '(' + str(GP_LB_LIST[id] + 1) + '连板)' else: s = s + '(首板)' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) GP_CZT_LIST.append(id) ''' GP_CHECK_ZT_LIST[id] = time.time() elif id not in GP_ZT_LIST: ltime = GP_CHECK_ZT_LIST[id] if time.time() - ltime > 60: GP_CHECK_ZT_LIST.pop(id) GP_ZT_LIST.append(id) #int(_os[10]) * _ocur # “买一”申请4695股,即47手 ''' return ''' else: #涨停开板 if id in GP_ZT_LIST: if FIRST_INIT != 1: if id in GP_ZT_CNT.keys(): GP_ZT_CNT[id] = GP_ZT_CNT[id] + 1 else: GP_ZT_CNT[id] = 1 s = '[开板][' + _otime + '] ' + _oname + ' ' + id + ' 打开涨停板' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) GP_ZT_LIST.remove(id) GP_CZT_LIST.remove(id) return ''' global GP_CDT_LIST#GP_CHECK_DT_LIST,GP_DT_LIST #跌停 if _ost: _corl = 0.95 else: _corl = 0.9 _dtj = Decimal(_ozsp * _corl).quantize(Decimal('0.00')) _dtj = '{:g}'.format(float(_dtj)) _dtj = float(_dtj) #_dtj = round(_ozsp * _corl,2) if _dtj == _ocur: #新增跌停板 if id not in GP_CDT_LIST: if FIRST_INIT != 1: if _open == _ocur: s = '[竞价][' + _otime + '] ' + _oname + ' ' + id + ' 竞价跌停' else: s = '[跌停][' + _otime + '] ' + _oname + ' ' + id + ' 跌停' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) print(' _ozsp:' + str(_ozsp)) GP_CDT_LIST.append(id) '''
def sina(cnt): global SINA_RUL url = SINA_RUL % (str(cnt)) res = net.send(url) if res == -1: return global GP_CATCH_DIC,SINA_BUY_TIP_LIST,SINA_SELL_TIP_LIST,FIRST_INIT res = res.replace('symbol', '"symbol"') res = res.replace('name', '"name"') res = res.replace('ticktime', '"ticktime"') res = res.replace(',price', ',"price"') res = res.replace('volume', '"volume"') res = res.replace('prev_price', '"prev_price"') res = res.replace('kind:', '"kind":') if res == 'null': return res = eval(res) for row in res: kind = row['kind'] if kind == 'E': continue code = row['symbol'][2:] data = GP_CATCH_DIC.get(code,{}) _ozsp = float(data.get('ed',0)) # 昨日收盘价格 cur = float(row['price']) prev = float(row['prev_price']) volume = float(row['volume']) if cur > prev and kind == 'D': ctime = row['ticktime'] sign = ctime + code if sign in SINA_BUY_TIP_LIST: continue SINA_BUY_TIP_LIST.append(sign) # 单笔拉升3% if _ozsp != 0 and ((cur / _ozsp) - (prev / _ozsp)) > 0.3: if FIRST_INIT != 1: s = '[拉盘][' + row['ticktime'] + '] ' + row['name'] + ' ' + code + ' 单笔拉升超3%' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) money = int(volume * cur / 10000) #if money < 100: # continue #大单主买 if FIRST_INIT != 1: s = '[主买][' + ctime + '] ' + row['name'] + ' ' + code + ' ' + str(int(volume/100)) + '手超大单买盘,金额:' + str(money) + '万元' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) elif cur < prev and kind == 'D': ctime = row['ticktime'] sign = ctime + code if sign in SINA_SELL_TIP_LIST: continue SINA_SELL_TIP_LIST.append(sign) # 单笔砸盘3% if _ozsp != 0 and ((prev / _ozsp) - (cur / _ozsp)) > 0.3: if FIRST_INIT != 1: s = '[砸盘][' + row['ticktime'] + '] ' + row['name'] + ' ' + code + ' 单笔砸盘超3%' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s) money = int(volume * cur / 10000) if money < 500: continue #大单主卖 if FIRST_INIT != 1: s = '[主卖][' + row['ticktime'] + '] ' + row['name'] + ' ' + code + ' ' + str(int(volume/100)) + '手超大单抛盘,金额:' + str(money) + '万元' qq.senMsgToBuddy(s) qq.sendMsgToGroup(s)