def UpdateStockList():
    drop_sql = 'drop table if exists stock.stock_multifactor_score_evaluation'
    mc.run_ddl(drop_sql)

    f_create_sql = mc.get_sql_text(sql_path +
                                   r'stock_multifactor_weight_evaluation.sql')
    create_sql = f_create_sql.format(years, indexname)
    print(create_sql)
    mc.run_ddl(create_sql)
    print('table stock_multifactor_score_evaluation created!')
Exemple #2
0
def SW_MonthlyReport():
    sql = mc.get_sql_text(sql_path + r'sw_sector_index_chg/monthly.sql')
    sw_sector_monthly = mc.run(sql)
    sw_sector_monthly.iloc[:, 4:] = sw_sector_monthly.iloc[:, 4:].applymap(
        numeric_format)

    ef.format_excel_file(sw_sector_monthly,
                         path=sw_sector_path + 'sw_sector_monthly.xlsx',
                         sheet_name='sector_monthly')
    sw_sector_monthly.head()
Exemple #3
0
def SW_WeeklyReport():
    sql = mc.get_sql_text(sql_path + r'sw_sector_index_chg/weekly_page.sql')
    wk_report = mc.run(sql)

    # 将文本转化为数字,注意列的位置,日期回转换为空值
    # wk_report.iloc[:, 4:] = wk_report.iloc[:, 4:].applymap(numeric_format)

    ef.format_excel_file(wk_report,
                         path=sw_sector_path + 'sw_sector_weekly.xlsx',
                         sheet_name='sector_weekly')
    print(wk_report.head())
    def RawStocklist(self, sw_indexname):
        # 查询申万一级行业股票池
        f_sql = mc.get_sql_text(
            sql_path +
            r'stock_basic_financial_report_research_weight_by_sw_indexname.sql'
        )
        sql = f_sql.format(sw_indexname)

        stock_list = mc.run(sql)
        # stock_list.fillna(0, inplace=True)

        print()
        print(f'一共获得{len(stock_list)}只股票')

        # stock_list.dropna(how='any', inplace=True)
        ef.format_excel_file(stock_list,
                             path=stock_path + r'stock_raw_list.xlsx',
                             sheet_name='stock')
        pprint(stock_list.head(5))
        return stock_list