Exemplo n.º 1
0
def runTask():
    # 周六执行每周任务
    if datetime.today().weekday() == 5 and datetime.now(
    ).hour >= 9 and datetime.now().hour < 10 and datetime.now().minute < 20:
        begin = datetime.now()

        # 执行每周任务
        initMysql()
        getStockListByPE(0)
        getSh50()
        getSh300()
        getMSCI()
        updateLatestGoodStockListToConfig()
        updateNewList()
        updateNewGoodList()
        # getStockHistoryInfo()
        disconnect()

        end = datetime.now()
        sendMessageToMySelf(
            unicode("本周获取PEG的任务执行完毕,当前时间:{0},执行用时:{1}").format(
                datetime.now(), end - begin))

    t = Timer(900, runTask)
    t.start()
Exemplo n.º 2
0
def runTask():
    if datetime.today().weekday() < 5 and datetime.now(
    ).hour >= 9 and datetime.now().hour < 10 and datetime.now().minute <= 20:
        begin = datetime.now()
        sendMessageToMySelf(unicode("启动今日提醒程序"))

        reminder()

        end = datetime.now()
        sendMessageToMySelf(
            unicode("今日提醒程序运行结束,当前时间:{0},执行用时:{1}").format(
                datetime.now(), end - begin))

    t = Timer(900, runTask)
    t.start()
Exemplo n.º 3
0
def runTask():
    if datetime.today().weekday() < 5 and datetime.now().hour >= 23 and datetime.now().hour < 24 and datetime.now().minute < 20:
        sendMessageToMySelf(unicode("开始计算今日技术指标数据"))
        begin = datetime.now()

        initMysql()
        updateKDJ()
        disconnect()
        end = datetime.now()

        message = unicode("计算今日技术指标数据的任务执行完毕,当前时间:{0},执行用时:{1}").format(datetime.now(), end - begin)
        writeLog(message)
        sendMessageToMySelf(message)

    t = Timer(900, runTask)
    t.start()
Exemplo n.º 4
0
def runTask():
    if datetime.today().weekday() < 5 and datetime.now(
    ).hour >= 19 and datetime.now().hour < 20 and datetime.now().minute < 20:
        sendMessageToMySelf(unicode("开始获取今日指数数据"))
        begin = datetime.now()

        initMysql()
        saveStockIndex()
        disconnect()

        end = datetime.now()
        sendMessageToMySelf(
            unicode("今日获取指数数据的任务执行完毕,当前时间:{0},执行用时:{1}").format(
                datetime.now(), end - begin))

    t = Timer(900, runTask)
    t.start()
Exemplo n.º 5
0
def runTask():
    if datetime.today().weekday() < 5 and datetime.now(
    ).hour >= 19 and datetime.now().hour < 20 and datetime.now().minute < 20:
        sendMessageToMySelf(unicode("开始获取今日股票行情数据"))
        begin = datetime.now()

        initMysql()
        saveStockInfo()
        checkHighChangePercentStockForcase()
        disconnect()

        end = datetime.now()
        sendMessageToMySelf(
            unicode("今日获取各个股票的行情数据的任务执行完毕,当前时间:{0},执行用时:{1}").format(
                datetime.now(), end - begin))

    t = Timer(900, runTask)
    t.start()
Exemplo n.º 6
0
def runTask():
    if datetime.today().weekday() < 5 and datetime.now(
    ).hour >= 22 and datetime.now().hour < 23 and datetime.now().minute < 25:
        sendMessageToMySelf(unicode("开始获取今日股票技术指标数据"))
        begin = datetime.now()

        initMysql()
        saveStockTech()
        disconnect()

        end = datetime.now()
        sys.setdefaultencoding('utf-8')
        sendMessageToMySelf(
            unicode("今日获取各个股票的技术指标数据的任务执行完毕,当前时间:{0},执行用时:{1}").format(
                datetime.now(), end - begin))

    t = Timer(900, runTask)
    t.start()
Exemplo n.º 7
0
def runTask():
    if datetime.today().weekday() < 5 and datetime.now(
    ).hour >= 22 and datetime.now().hour < 23 and datetime.now().minute < 20:
        sendMessageToMySelf(unicode("开始进行明日技术指标预测"))
        begin = datetime.now()

        initMysql()

        disconnect()

        end = datetime.now()
        sys.setdefaultencoding('utf-8')
        sendMessageToMySelf(
            unicode("明日技术指标预测的任务执行完毕,当前时间:{0},执行用时:{1}").format(
                datetime.now(), end - begin))

    t = Timer(900, runTask)
    t.start()
Exemplo n.º 8
0
def runTask():
    # 周六执行每周任务
    # if datetime.today().weekday() == 5 and datetime.now().hour >= 8 and datetime.now().hour < 9 and datetime.now().minute < 20:
    begin = datetime.now()

    # 执行每周任务
    getStockListByPE(0)
    getSh50()
    getSh300()
    getMSCI()
    # updateLatestGoodStockListToConfig()
    # updateNewList()
    # updateNewGoodList()
    # getStockHistoryInfo()

    end = datetime.now()
    sendMessageToMySelf(
        unicode("本周获取PEG的任务执行完毕,当前时间:{0},执行用时:{1}").format(
            datetime.now(), end - begin))
Exemplo n.º 9
0
def runTask():
    if datetime.today().weekday() < 5 and datetime.now(
    ).hour >= 9 and datetime.now().hour < 10 and datetime.now().minute <= 20:
        begin = datetime.now()
        sendMessageToMySelf(unicode("启动均线数据提醒"))

        initMysql()
        stockList = loadJsonConfig(
            os.path.abspath(
                os.path.join(os.getcwd(), "../config/avglineReminder.json")))
        checkAvgline(stockList)
        disconnect()

        end = datetime.now()
        sendMessageToMySelf(
            unicode("今日均线数据提醒程序运行结束,当前时间:{0},执行用时:{1}").format(
                datetime.now(), end - begin))

    t = Timer(900, runTask)
    t.start()
Exemplo n.º 10
0
def main(argv):
    try:
        reload(sys)
        sys.setdefaultencoding('utf-8')

        # sendMessageToMySelf(unicode("开始查询股票历史行情数据"))
        begin = datetime.now()
        initMysql()
        # getStockHistoryInfoFromDb()
        # getStockHistoryInfoFromConfig()
        updateStockOtherInfo()
        disconnect()
        end = datetime.now()

        message = unicode("查询股票历史行情数据的任务执行完毕,当前时间:{0},执行用时:{1}").format(
            datetime.now(), end - begin)
        writeLog(message)
        sendMessageToMySelf(message)
    except:
        writeExceptionLog('RealTimeRemindTask Error.')
Exemplo n.º 11
0
def runTask():
    if datetime.today().weekday() < 5 and datetime.now(
    ).hour >= 20 and datetime.now().hour < 21 and datetime.now().minute < 20:
        sendMessageToMySelf(unicode("开始获取AvgLine数据"))
        begin = datetime.now()

        initMysql()
        stockList = getCodeList()
        checkAvgLine("avgline.csv", stockList, False)

        stockList = select(
            unicode("SELECT code,name from s_stock_info")
        )  # loadJsonConfig(os.path.abspath(os.path.join(os.getcwd(), "../config/goodStockList.json")))
        checkAvgLine("avgline_all.csv", stockList)
        disconnect()

        end = datetime.now()
        sendMessageToMySelf(
            unicode("今日获取AvgLine的任务执行完毕,当前时间:{0},执行用时:{1}").format(
                datetime.now(), end - begin))

    t = Timer(900, runTask)
    t.start()
Exemplo n.º 12
0
def reminder():
    reminderCodeList = open(
        os.path.abspath(os.path.join(os.getcwd(), "../config/reminder.csv")),
        'r').readlines()

    dictReminder = {}
    for i in range(1, len(reminderCodeList)):
        infos = reminderCodeList[i].split(',')
        code = infos[0].strip().zfill(6)
        name = getPE(code)[0]
        maxPrice = float(infos[1])
        minPrice = float(infos[2])
        upPercent = float(infos[3])
        downPercent = float(infos[4])
        receiver = int(infos[5])
        dictReminder[code] = ReminderInfo(maxPrice, minPrice, upPercent,
                                          downPercent, receiver, code, name)

    checkDict = {}  # 用于检查今天是否已经发送过某类信息
    date = datetime.now().strftime('%Y-%m-%d')
    result = []
    result.append(
        unicode("{0},{1},{2},{3},{4},{5}\n").format(
            '股票代码', '股票涨到多少元', '股票跌到多少元', '股票涨幅超过多少(%)', '股票跌幅超过多少(%)',
            '发给谁(0:期待,1:踏雪)').encode('gbk'))

    while 1 == 1:
        if datetime.now().hour >= 16:
            # 更新提醒数据
            for i in range(1, len(reminderCodeList)):
                infos = reminderCodeList[i].split(',')
                code = infos[0].strip().zfill(6)
                name = getPE(code)[0]
                maxPrice = float(infos[1])
                minPrice = float(infos[2])
                upPercent = float(infos[3])
                downPercent = float(infos[4])
                receiver = int(infos[5])

                stockInfo = getStockInfo(code)
                if stockInfo is None:
                    continue

                highPrice = float(stockInfo['highPrice'])
                closePrice = float(stockInfo['closePrice'])
                changePercent = float(stockInfo['changePercent'])
                newMinPrice = getAboveNumber(closePrice * 0.97)
                minPrice = minPrice if minPrice == -1 or changePercent <= 0 or newMinPrice <= minPrice else newMinPrice
                maxPrice = maxPrice if maxPrice == -1 or changePercent <= 0 else getAboveNumber(
                    highPrice * 1.03)
                result.append(
                    unicode("{0},{1},{2},{3},{4},{5}\n").format(
                        code, maxPrice, minPrice, upPercent, downPercent,
                        receiver).encode('gbk'))

            saveFileName = os.path.abspath(
                os.path.join(os.getcwd(), "../config/reminder.csv"))
            writeFile(saveFileName, result)
            writeLog(unicode("止损表已经修正为以下值:{0}").format(result))
            sendMessageToMySelf(unicode("止损表已经修正为以下值:{0}").format(result))
            break

        for key in dictReminder:
            df = ts.get_realtime_quotes(key)
            reminderInfo = dictReminder[key]

            price = float(df['price'].values[0])
            pre_close = float(df['pre_close'].values[0])
            currentUpPercent = 0 if price <= pre_close else round(
                (price - pre_close) * 100 / pre_close, 2)
            currentDownPercent = 0 if price >= pre_close else round(
                (price - pre_close) * 100 / pre_close, 2)

            print key, price, reminderInfo.maxPrice, reminderInfo.minPrice, currentUpPercent, currentDownPercent
            if (price != 0 and reminderInfo.maxPrice != -1
                    and price >= reminderInfo.maxPrice):
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'max')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{3},当前价格为:{1},已经超过您预设的{2}').format(
                            key, price, reminderInfo.maxPrice,
                            reminderInfo.name)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

            if (price != 0 and reminderInfo.minPrice != -1
                    and price <= reminderInfo.minPrice):
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'min')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{3},当前价格为:{1},已经低于您预设的{2}').format(
                            key, price, reminderInfo.minPrice,
                            reminderInfo.name)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

            if (price != 0 and reminderInfo.upPercent != -1
                    and currentUpPercent >= reminderInfo.upPercent):
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'up')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{4},当前价格为:{1},涨幅为:{2}%,已经超过您预设的{3}%'
                    ).format(key, price, currentUpPercent,
                             reminderInfo.upPercent, reminderInfo.name)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

            if (price != 0 and reminderInfo.downPercent != -1
                    and currentDownPercent <= -reminderInfo.downPercent):
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'down')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{4},当前价格为:{1},跌幅为:{2}%,已经低于您预设的{3}%'
                    ).format(key, price, currentDownPercent,
                             -reminderInfo.downPercent, reminderInfo.name)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

        time.sleep(1)
Exemplo n.º 13
0
def checkAvgline(stockList):
    date = (datetime.now() - timedelta(days=1)).strftime('%Y-%m-%d')
    dictLastRemindPrice = {}
    while 1 == 1:
        if datetime.now().hour >= 16:
            # 今日提醒程序结束
            return

        for stock in stockList:
            code = stock[0]
            name = stock[1]
            try:
                sql = unicode(
                    "SELECT code,date,MA5,MA10,MA20,MA30,MA60,MA120,MA250 from s_stock where code='{0}' and date='{1}'"
                ).format(code, date)
                data = select(sql)
                if (len(data) <= 0):
                    writeLog(
                        unicode("没有获取到均值数据, code: {0}, date: {1}").format(
                            code, date))
                    continue

                ma5 = data[0][2]
                ma10 = data[0][3]
                ma30 = data[0][5]
                ma60 = data[0][6]
                ma120 = data[0][7]
                ma250 = data[0][8]

                lastPrice = getNPrice(
                    code, 1, 'high') if not dictLastRemindPrice.has_key(
                        code) else dictLastRemindPrice.get(code)
                realTimePrice = float(getRealTimeData(code))
                print name, lastPrice, realTimePrice

                if (lastPrice != 0 and realTimePrice != 0 and lastPrice <= ma5
                        and realTimePrice >= ma5):
                    # 击穿5日均线,并上涨
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '5up', lastPrice, realTimePrice, ma5, name))
                    writeLog(
                        unicode(
                            "[remind_5up] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma5: {3}"
                        ).format(code, lastPrice, realTimePrice, ma5))

                if (lastPrice != 0 and realTimePrice != 0 and lastPrice <= ma10
                        and lastPrice >= ma10):
                    # 击穿10日均线,并上涨
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '10up', lastPrice, realTimePrice, ma10,
                            name))
                    writeLog(
                        unicode(
                            "[remind_10up] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma10: {3}"
                        ).format(code, lastPrice, realTimePrice, ma10))

                if (lastPrice != 0 and realTimePrice != 0 and lastPrice <= ma30
                        and realTimePrice >= ma30):
                    # 击穿30日均线,并上涨
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '30up', lastPrice, realTimePrice, ma30,
                            name))
                    writeLog(
                        unicode(
                            "[remind_30up] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma30: {3}"
                        ).format(code, lastPrice, realTimePrice, ma30))

                if (lastPrice != 0 and realTimePrice != 0 and lastPrice <= ma60
                        and realTimePrice >= ma60):
                    # 击穿60日均线,并上涨
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '60up', lastPrice, realTimePrice, ma60,
                            name))
                    writeLog(
                        unicode(
                            "[remind_60up] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma60: {3}"
                        ).format(code, lastPrice, realTimePrice, ma60))

                if (lastPrice != 0 and realTimePrice != 0
                        and lastPrice <= ma120 and realTimePrice >= ma120):
                    # 击穿120日均线,并上涨
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '120up', lastPrice, realTimePrice, ma120,
                            name))
                    writeLog(
                        unicode(
                            "[remind_120up] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma120: {3}"
                        ).format(code, lastPrice, realTimePrice, ma120))

                if (lastPrice != 0 and realTimePrice != 0
                        and lastPrice <= ma250 and realTimePrice >= ma250):
                    # 击穿250日均线,并上涨
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '250up', lastPrice, realTimePrice, ma250,
                            name))
                    writeLog(
                        unicode(
                            "[remind_250up] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma250: {3}"
                        ).format(code, lastPrice, realTimePrice, ma250))

                if (lastPrice != 0 and realTimePrice != 0 and lastPrice >= ma5
                        and realTimePrice <= ma5):
                    # 击穿5日均线,并下跌
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '5down', lastPrice, realTimePrice, ma5,
                            name))
                    writeLog(
                        unicode(
                            "[remind_5down] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma5: {3}"
                        ).format(code, lastPrice, realTimePrice, ma5))

                if (lastPrice != 0 and realTimePrice != 0 and lastPrice >= ma10
                        and realTimePrice <= ma10):
                    # 击穿10日均线,并下跌
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '10down', lastPrice, realTimePrice, ma10,
                            name))
                    writeLog(
                        unicode(
                            "[remind_10down] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma10: {3}"
                        ).format(code, lastPrice, realTimePrice, ma10))

                if (lastPrice != 0 and realTimePrice != 0 and lastPrice >= ma30
                        and realTimePrice <= ma30):
                    # 击穿30日均线,并下跌
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '30down', lastPrice, realTimePrice, ma30,
                            name))
                    writeLog(
                        unicode(
                            "[remind_30down] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma30: {3}"
                        ).format(code, lastPrice, realTimePrice, ma30))

                if (lastPrice != 0 and realTimePrice != 0 and lastPrice >= ma60
                        and realTimePrice <= ma60):
                    # 击穿60日均线,并下跌
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '60down', lastPrice, realTimePrice, ma60,
                            name))
                    writeLog(
                        unicode(
                            "[remind_60down] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma60: {3}"
                        ).format(code, lastPrice, realTimePrice, ma60))

                if (lastPrice != 0 and realTimePrice != 0
                        and lastPrice >= ma120 and realTimePrice <= ma120):
                    # 击穿120日均线,并下跌
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '120down', lastPrice, realTimePrice, ma120,
                            name))
                    writeLog(
                        unicode(
                            "[remind_120down] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma120: {3}"
                        ).format(code, lastPrice, realTimePrice, ma120))

                if (lastPrice != 0 and realTimePrice != 0
                        and lastPrice >= ma250 and realTimePrice <= ma250):
                    # 击穿250日均线,并下跌
                    sendMessageToMySelf(
                        unicode("{0},{5},{1},{2},{3},{4}\n").format(
                            code, '250down', lastPrice, realTimePrice, ma250,
                            name))
                    writeLog(
                        unicode(
                            "[remind_250down] code:{0}, yesterdayPrice: {1}, realTimePrice: {2}, ma250: {3}"
                        ).format(code, lastPrice, realTimePrice, ma250))

                dictLastRemindPrice[code] = realTimePrice
            except Exception, e:
                writeErrorLog(
                    unicode(
                        "remind_checkAvgLineFailed, code:{0}, e:{1}").format(
                            code, str(e)))

        time.sleep(1)
Exemplo n.º 14
0
def reminder():
    reminderCodeList = open(
        os.path.abspath(os.path.join(os.getcwd(), "../config/myreminder.csv")),
        'r').readlines()

    dictReminder = {}
    for i in range(1, len(reminderCodeList)):
        infos = reminderCodeList[i].split(',')
        code = infos[0].strip().zfill(6)
        name = getPE(code)[0]
        maxPrice = float(infos[1])
        minPrice = float(infos[2])
        buyPrice = float(infos[3])
        upPercent = float(infos[4])
        downPercent = float(infos[5])
        receiver = int(infos[6])
        sql = unicode(
            "SELECT changePercent,closePrice,highPrice from s_stock where code='{0}' ORDER by date desc limit 30"
        ).format(code)
        data = select(sql)

        totalChangePercentBefore = 0
        yesterdayChangePercent = 0
        yesterdayHighPrice = 0
        if data is not None:
            yesterdayChangePercent = data[0][0]
            yesterdayHighPrice = float(data[0][2])
            for i in range(1, len(data)):
                changePercent = data[i][0]
                if (changePercent < 0):
                    break
                totalChangePercentBefore = totalChangePercentBefore + changePercent
            totalChangePercentBefore = totalChangePercentBefore + yesterdayChangePercent

        dictReminder[code] = ReminderInfo(maxPrice, minPrice, upPercent,
                                          downPercent, receiver, code, name,
                                          buyPrice, yesterdayHighPrice,
                                          float(yesterdayChangePercent),
                                          float(totalChangePercentBefore))

    checkDict = {}  # 用于检查今天是否已经发送过某类信息
    date = datetime.now().strftime('%Y-%m-%d')
    result = []
    result.append(
        unicode("{0},{1},{2},{3},{4},{5},{6}\n").format(
            '股票代码', '股票涨到多少元', '股票跌到多少元', '买入价', '股票涨幅超过多少(%)', '股票跌幅超过多少(%)',
            '发给谁(0:期待,1:踏雪)').encode('gbk'))

    while 1 == 1:
        if datetime.now().hour >= 16:
            # 更新提醒数据
            for i in range(1, len(reminderCodeList)):
                infos = reminderCodeList[i].split(',')
                code = infos[0].strip().zfill(6)
                maxPrice = float(infos[1])
                minPrice = float(infos[2])
                buyPrice = float(infos[3])
                upPercent = float(infos[4])
                downPercent = float(infos[5])
                receiver = int(infos[6])

                stockInfo = getStockInfo(code)
                if stockInfo is None:
                    continue

                highPrice = float(stockInfo['highPrice'])
                closePrice = float(stockInfo['closePrice'])
                changePercent = float(stockInfo['changePercent'])
                newMinPrice = getAboveNumber(closePrice * 0.958)
                minPrice = minPrice if minPrice == -1 or changePercent <= 0 or newMinPrice <= minPrice else newMinPrice
                maxPrice = maxPrice if maxPrice == -1 or changePercent <= 0 else getAboveNumber(
                    highPrice * 1.03)
                result.append(
                    unicode("{0},{1},{2},{3},{4},{5},{6}\n").format(
                        code, maxPrice, minPrice, buyPrice, upPercent,
                        downPercent, receiver).encode('gbk'))

            saveFileName = os.path.abspath(
                os.path.join(os.getcwd(), "../config/myreminder.csv"))
            writeFile(saveFileName, result)
            sendMessageToMySelf(unicode("止损表已经修正为以下值:{0}").format(result))
            break

        for key in dictReminder:
            df = ts.get_realtime_quotes(key)
            reminderInfo = dictReminder[key]

            price = float(df['price'].values[0])
            highPrice = float(df['high'].values[0])
            pre_close = float(df['pre_close'].values[0])
            todayUpPercent = 0 if price <= pre_close else round(
                (price - pre_close) * 100 / pre_close, 2)
            todayDownPercent = 0 if price >= pre_close else round(
                (price - pre_close) * 100 / pre_close, 2)
            highPercent = round((highPrice - pre_close) * 100 / pre_close, 2)
            currentPercent = round((price - pre_close) * 100 / pre_close, 2)

            if (price <= reminderInfo.buyPrice * 0.88):  # 跌破12%,止损
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'sell12')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{1},成本价:{2}, 当前价格为:{3},跌幅:{4}%').format(
                            key, reminderInfo.name, reminderInfo.buyPrice,
                            price, (price - reminderInfo.buyPrice) /
                            reminderInfo.buyPrice)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

            if (price <= reminderInfo.yesterdayHighPrice * 0.95
                    and price > reminderInfo.buyPrice):  # 最高收益回落5%
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'sell5')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{1},成本价:{2}, 当前价格为:{3},昨日最高价:{4}%'
                    ).format(key, reminderInfo.name, reminderInfo.buyPrice,
                             price, reminderInfo.yesterdayHighPrice)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

            # 今日最高价与当前价,跌幅超过了4.5
            if (highPercent > 0 and highPercent - currentPercent > 4.5):
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'highdown')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{1},今日最高价:{2}, 当前价格为:{3},最高涨幅:{4}%,当前涨幅为:{5}%,两者跌幅已经您预设的{6}%'
                    ).format(key, reminderInfo.name, highPrice, price,
                             highPercent, currentPercent, 4.5)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

            # 当前涨幅已经超过预设的涨幅,目前为8%
            if (reminderInfo.upPercent != -1
                    and todayUpPercent >= reminderInfo.upPercent):
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'cup')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{4},当前价格为:{1},涨幅为:{2}%,已经超过您预设的{3}%'
                    ).format(key, price, todayUpPercent,
                             reminderInfo.upPercent, reminderInfo.name)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

            # 昨天和当前总跌幅已经超过25%
            if (todayUpPercent + reminderInfo.totalChangePercentLast30Days >=
                    25):
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'tup')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{4},当前价格为:{1},累计涨幅为:{2}%,已经超过您预设的{3}%'
                    ).format(
                        key, price, todayUpPercent +
                        reminderInfo.totalChangePercentLast30Days, 25,
                        reminderInfo.name)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

            # 当前跌幅已经超过预设的跌幅,目前为4.2%
            if (reminderInfo.downPercent != -1
                    and todayDownPercent <= -reminderInfo.downPercent):
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'cdown')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{4},当前价格为:{1},跌幅为:{2}%,已经低于您预设的{3}%'
                    ).format(key, price, todayDownPercent,
                             -reminderInfo.downPercent, reminderInfo.name)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

            # 昨天和当前总跌幅已经超过4.2%
            if (todayDownPercent + reminderInfo.yesterdayChangePercent <=
                    -4.2):
                checkKey = unicode('{0}_{1}_{2}').format(date, key, 'tdown')
                if checkDict.has_key(checkKey) == False:
                    message = unicode(
                        '股票代码:{0},名称:{4},当前价格为:{1},昨日和当前总跌幅为:{2}%,已经低于您预设的{3}%'
                    ).format(
                        key, price,
                        todayDownPercent + reminderInfo.yesterdayChangePercent,
                        str(-4.2), reminderInfo.name)
                    writeInfoLog(message)
                    sendMessageToMySelf(
                        message
                    ) if reminderInfo.receiver == 1 else sendMessageToBaby(
                        message)
                    checkDict[checkKey] = True

        time.sleep(1)