示例#1
0
def get_billboard(start_date=None, end_date=None, count=None):
    jq.login()

    billboard_data = sdk.get_billboard_list(stock_list=None, start_date=start_date, end_date=end_date, count=count)

    billboard_list = []
    for index in billboard_data.index:
        index_billboard_data = billboard_data.iloc[index]

        code = index_billboard_data['code']
        date = index_billboard_data['day'].strftime('%Y-%m-%d')
        direction = index_billboard_data['direction']
        abnormal_code = int(index_billboard_data['abnormal_code'])
        abnormal_name = index_billboard_data['abnormal_name']
        sales_depart_name = index_billboard_data['sales_depart_name']
        rank = int(index_billboard_data['rank'])
        buy_value = is_nan(float(index_billboard_data['buy_value']))
        buy_rate = is_nan(float(index_billboard_data['buy_rate']))
        sell_value = is_nan(float(index_billboard_data['sell_value']))
        sell_rate = is_nan(float(index_billboard_data['sell_rate']))
        net_value = is_nan(float(index_billboard_data['net_value']))
        amount = is_nan(float(index_billboard_data['amount']))

        index_billboard = (
            code, date, direction, abnormal_code, abnormal_name, sales_depart_name, rank, buy_value, buy_rate,
            sell_value, sell_rate, net_value, amount)
        print(index_billboard)
        billboard_list.append(index_billboard)

    insert_sql = "insert into billboard(code, date, direction, abnormal_code, abnormal_name, sales_depart_name, `rank`, buy_value, buy_rate, sell_value, sell_rate, net_value, amount) " \
                 " values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
    my.insert_many(insert_sql, billboard_list)
示例#2
0
def sendBillBoardPic2QQ():

    df_today = jq.get_billboard_list(start_date=get_current_date_str())

    abnor_list = list(df_today.groupby(by='abnormal_name'))

    # 打印4类
    df_duplicate_4 = abnor_list[4][1].loc[~abnor_list[4][1]['code'].duplicated(), :]
    code_list_4 = [x[:6] for x in list(df_duplicate_4['code'].values)]

    printStkListPic2QQ(code_list_4, '影子2', title=abnor_list[4][0])

    # 打印1类
    df_duplicate_1 = abnor_list[1][1].loc[~abnor_list[1][1]['code'].duplicated(), :]
    code_list_1 = [x[:6] for x in list(df_duplicate_1['code'].values)]

    printStkListPic2QQ(code_list_1, '影子2', title=abnor_list[1][0])