Example #1
0
def sendConcernedStkPicToSelf_V2():
    """
    将自己关心的数据打印出图,发送到qq
    相较于之前版本,本次改进为:
    1、使用json文件中的code列表代替数据库中的列表
    2、进行判断,出发发送条件再予以发送
    :return:
    """
    towho = '影子2'
    send_qq(towho, '以下是已入的stk的形势图:')
    code_list = read_config()['buy_stk']

    for x in code_list + ['sh', 'sz', 'cyb']:

        df = get_k_data_JQ(x, 400)
        fig, _ = genStkPicForQQ(df)

        plt.title(str(x))
        send_pic_qq(towho, fig)
        # plt.show()
        plt.close()

        fig, _ = genStkIdxPicForQQ(df)

        plt.title(str(x))
        send_pic_qq(towho, fig)
        # plt.show()
        plt.close()

        send_W_M_MACD(x, towho)
Example #2
0
def sendConcernedStkPicToSelf_T():
    """
    将自己关心的数据打印出图,发送到qq
    :return:
    """
    towho = '影子2'
    send_qq(towho, '以下是已入的stk的形势图:')

    stk_buy = read_config()['buy_stk']

    for x in stk_buy + ['sh', 'sz', 'cyb']:

        df = get_k_data_JQ(x, 400)
        fig, _, attention = genStkPicForQQ(df, x)

        if attention:
            send_pic_qq(towho, fig)
            send_W_M_MACD(x, towho)
        plt.close()

        # 打印第二张套图
        fig, _, attention = genStkIdxPicForQQ(df, x)
        if attention:
            send_pic_qq(towho, fig)

        plt.close()
Example #3
0
def checkWeekStrayForAll():

    towho = '影子2'
    send_qq(towho, '以下是今晚海选结果:')

    df_total = ts.get_stock_basics()

    # 过滤掉年龄小于四岁的
    df_age_filter = df_total[df_total.apply(lambda x: int(
        str(x['timeToMarket'])[:4]) <= int(get_current_date_str()[:4]) - 4,
                                            axis=1)]

    # 根据week反转情况进行过滤,保留有反转的单位
    df_age_filter_stray = list(df_age_filter.reset_index().apply(
        lambda x: (x['code'], week_MACD_stray_judge(x['code'], towho)),
        axis=1))

    # 过滤掉非反转的情况
    df_age_f2 = list(filter(lambda x: x[1][0], df_age_filter_stray))

    # 增加stk的水平信息
    df_level = [(x[0], x[1][1], cal_stk_p_level(x[1][1]['close'].values))
                for x in df_age_f2]

    # 按总体水平排序,筛选优异者
    df_level.sort(key=lambda x: x[2]['total_last'])
    df_level = df_level[:math.floor(len(df_level) / 3 * 2)]

    # 按照近30的波动率进行排序,筛选优异者
    df_level.sort(key=lambda x: x[2]['std'], reverse=True)
    df_level = df_level[:math.floor(len(df_level) / 3 * 2)]

    # 按照近30的水平排序,留下最后8只
    df_level.sort(key=lambda x: x[2]['t30_last'], reverse=False)
    df_level = df_level[:np.min([math.floor(len(df_level) / 3 * 2), 15])]

    # 打印信息
    stk_list = [k[0] for k in df_level]

    for stk in stk_list:

        # 打印周与月信息
        send_W_M_MACD(stk_code=stk, towho=towho)

        # 打印日线信息
        df = get_k_data_JQ(stk, count=400, end_date=get_current_date_str())
        fig, _, _ = genStkPicForQQ(df)

        plt.title(str(stk))
        send_pic_qq(towho, fig)
        plt.close()

        fig, _, _ = genStkIdxPicForQQ(df)

        plt.title(str(stk))
        send_pic_qq(towho, fig)
        plt.close()
Example #4
0
def printStkListPic2QQ(code_list, towho, title=None):

    if title is not None:
        title_str = title
    else:
        title_str = ''

    for x in code_list:
        df = get_k_data_JQ(x, 400)
        fig, _ = genStkPicForQQ(df)

        plt.title(str(x) + title_str)
        send_pic_qq(towho, fig)
        plt.close()

        fig, _ = genStkIdxPicForQQ(df)

        plt.title(str(x) + title_str)
        send_pic_qq(towho, fig)
        plt.close()
Example #5
0
def sendMainIndexStkPic2Public():
    """
    将自己关心的数据打印出图,发送到qq
    :return:
    """

    for x in ['sh', 'sz', 'cyb']:

        df = get_k_data_JQ(x, 400)
        fig, _ = genStkPicForQQ(df)

        plt.title(str(x))
        send_pic_qq('大盘上涨概率公示', fig)
        plt.close()

        fig, _ = genStkIdxPicForQQ(df)

        plt.title(str(x))
        send_pic_qq('大盘上涨概率公示', fig)
        plt.close()
Example #6
0
# encoding=utf-8