Esempio n. 1
0
def listen():
    denyCodes = []
    code_items_rel = me['code_items_rel']
    code_preCloseDistance_rel = me['code_preCloseDistance_rel']
    candidates = me['candidates']
    codes = [item[0] for item in candidates]
    while True:
        if util.getHMS() > '15:00:00': break
        ret = util.getRealTime_Prices(codes)
        code_price_rel = ret['code_price_rel']
        code_rate_rel = ret['code_rate_rel']
        for code in code_price_rel.keys():
            if code not in code_rate_rel.keys(
            ) or code_rate_rel[code] > Listen_CurrentLimitRate:
                continue
            if code in denyCodes: continue
            nowDistance = 0
            for item in code_items_rel[code]:
                close = float(item['close'])
                if code_price_rel[code] >= close:
                    nowDistance = nowDistance + 1
                else:
                    break
            distance = nowDistance - code_preCloseDistance_rel[code]

            #print(distance)
            # 发现符合标的,发送通知给我审核
            if distance > Filter_High_Distance:
                try:
                    requests.get(
                        'http://95.163.200.245:64210/smtpclient/zhuizhang_allow_security_buy/'
                        + code + '/[email protected]')
                except:
                    time.sleep(5)
                log.log("Send: " + code + " Distance: " + str(distance))
                denyCodes.append(code)

        time.sleep(10)
Esempio n. 2
0
                        'http://95.163.200.245:64210/smtpclient/zhuizhang_allow_security_buy/'
                        + code + '/[email protected]')
                except:
                    time.sleep(5)
                log.log("Send: " + code + " Distance: " + str(distance))
                denyCodes.append(code)

        time.sleep(10)


log.log("Start Mode_ZhuiZhang")
prepareComplete = False
filterComplete = False
while True:
    today = util.getYMD()
    now = util.getHMS()
    if prepareComplete is False and (util.isOpen(today) and now > '09:00:00'):
        log.log('start prepare...')
        prepare()
        prepareComplete = True
    if filterComplete is False and (util.isOpen(today) and now > '09:00:00'):
        log.log('start filter...')
        filter()
        filterComplete = True
    if util.isOpen(today) and '09:30:00' < now < '15:00:00':
        log.log('start listen...')
        listen()
        me = {}
        prepareComplete = False
        filterComplete = False