Esempio n. 1
0
def em_fund_attr():
    '''
    '''

    fund_type = ['债券指数',
                 '债券型',
                 '定开债券',
                 '固定收益',
                 
                 '混合型',
                 
                 '股票指数',
                 '股票型',
                 
                 '联接基金',
                 '混合-FOF',
                 '股票-FOF',
                 
                 'ETF-场内',
                 'QDII-ETF',
                 
                 'QDII',
                 'QDII-指数',
                 
                 '分级杠杆',
                 # '货币型',     
                 # '理财型',
                 # '保本型',
                 # '其他创新',
                 ]
    
    fund_set = ak.fund_em_fund_name().rename(
        columns={'基金代码': 'fund_code'})
    
    return fund_set[fund_set['基金类型'].isin(fund_type)]
Esempio n. 2
0
 def __get_all_funds(self) -> pd.DataFrame:
     logger.info("初始化全量基金")
     fund_cate = ak.fund_em_fund_name()
     fund_cate.rename(columns={'基金类型': 'fund_type', '基金简称': 'fund_name', '基金代码': 'fund_code'},
                      inplace=True)
     fund_cate = fund_cate[['fund_code', 'fund_name', 'fund_type']]
     return fund_cate
Esempio n. 3
0
def funds_info() -> dict:
    df = ak.fund_em_fund_name()
    df = df.rename({'基金代码': '_id', '基金简称': 'name', '基金类型': 'type'}, axis=1)
    df['_id'] = df['_id'].apply(lambda x: int(x))
    df['typ2'] = df['type'].apply(lambda x: x.split('-')[1] if '-' in x else None)
    df['type'] = df['type'].apply(lambda x: x.split('-')[0])
    df = df[['_id', 'name', 'type', 'typ2']]
    print(df)
    return json.loads(df.T.to_json())
Esempio n. 4
0
 def get_fund_list(self):
     '''更新基金列表'''
     fund_em_fund_name_df = ak.fund_em_fund_name()
     rt_trade_df = ak.fund_em_open_fund_daily()
     rt_trade_df = rt_trade_df.loc[:, ['基金代码', '申购状态']]
     fund_em_fund_name_df = fund_em_fund_name_df.merge(rt_trade_df, how='left', on='基金代码')
     fund_em_fund_name_df = fund_em_fund_name_df.loc[~fund_em_fund_name_df["基金代码"].isin(self.filter_fund_type)]
     joblib.dump(fund_em_fund_name_df, self.ALL_MARKET_FUND_INFO_FILE)
     return self
Esempio n. 5
0
 def test_load_fund_names(self):
     df = ak.fund_em_fund_name()
     print(df.to_string())
Esempio n. 6
0
#%%
fig, ax = plt.subplots(4, 1)
ax[0].plot(df_fgthczhh_003494.index, df_fgthczhh_003494['累计净值'])
ax[1].plot(df_xqqs_163402.index, df_xqqs_163402['累计净值'])
ax[2].plot(df_yfdzxp_110011.index, df_yfdzxp_110011['累计净值'])
ax[3].plot(df_zosdxf_004241.index, df_zosdxf_004241['累计净值'])

#%%

# dates.dt.strftime('%Y-%m-%d')
# datetime_list = pd.to_datetime(fund_em_info_df['净值日期'], format='%Y-%m-%d')
# date_rng_list = date_rng.format()

#%%
import akshare as ak
fund_em_fund_name_df = ak.fund_em_fund_name()
print(fund_em_fund_name_df)

#%%
fund_names = [
    '富国天惠成长混合C', '003494', '中欧价值', '004232', '兴全趋势', '163402', '中欧新蓝筹',
    '004237', '中欧时代先锋股票C', '004241', '华安升级', '040020', '汇添富成长', '011402',
    '兴全合润', '163406', '民生加银', '000136', '景顺长城动力', '260103', '易方达消费', '009265',
    '银华内需', '161810', '永赢惠添利', '005711', '广发双擎升级', '009314', '易方达中小盘',
    '110011', '广发稳健增长', '009326', '华夏回报 ', '新锐公募基金经理', '平安智慧中国', '中欧医疗创新',
    '银华富裕主题', '交银新生活力', '富国科创主题3年', '汇添富医药保健', '工银科技创新3年', '汇添富消费升级', '嘉实新兴产业'
]

fund_em_fund_name_df['基金简称']

print(fund_em_fund_name_df[fund_em_fund_name_df['基金简称'] == '华夏成长混合'])