コード例 #1
0
def contract(tdy, top):
    dic = contracts.main_contracts(tdy, top)
    for key in ['IC', 'IH', 'IF', 'T', 'TF']:
        dic[key] = indexcode[key]
    for key in ineffective_cmt:  #删除效果不好的品种
        del (dic[key])
    return dic
コード例 #2
0
ファイル: money_flow_main.py プロジェクト: mikimaus78/Work
def money_flow_main(date, top_N, cmt_list, interval=1):
    d = main_contracts(date, top_N)
    df_TopContractList = pd.DataFrame(d, index=1 + np.arange(top_N)).T

    ## 计算资金流向
    df = get_data(date, df_TopContractList)
    df_g = df.groupby(df['commodity_name']).sum().reset_index()
    cmt_list.index = [x[:-4] for x in cmt_list.index.tolist()]
    df_g['commodity_name'] = cmt_list.loc[
        df_g['commodity_name'].tolist(), :]["Chinese"].tolist()
    ## 生成资金流向柱状图
    name_of_date = date + str(interval) + u"日"
    fig_list = PlotMoneyFlow(df_g, date, name_of_date)
    return fig_list
コード例 #3
0
def contract(tdy,top):
    dic=contracts.main_contracts(tdy,top)
    for key in ['IC','IH','IF','T','TF']:
        del(dic[key])  
    return dic