def update_resumen(start_date, end_date): # dataframes df_vf = query_by_daterange("valor_fondos", start_date, end_date) df_vf = df_vf[(df_vf != 0).all(1)] df_q = query_by_daterange("q_index", start_date, end_date) df_q = df_q[(df_q != 0).all(1)] usdclp = query_by_daterange("usdclp", start_date, end_date) usdclp = usdclp.drop_duplicates(subset=['Fecha'], keep='first', inplace=False, ignore_index=True).reset_index() df_nacio = query_by_daterange("inversion_nacional", start_date, end_date).dropna() df_inter = query_by_daterange("inversion_internacional", start_date, end_date).dropna() df_fn = query_by_daterange("forwards_nacionales", start_date, end_date) dfc = df_fn[df_fn['Nombre'] == 'Compra'] dfv = df_fn[df_fn['Nombre'] == 'Venta'] df_activos = query_by_daterange("activos", start_date, end_date).dropna() df_bonos_clp = df_activos[df_activos['Nombre'] == 'Bonos CLP'] df_bonos_uf = df_activos[df_activos['Nombre'] == 'Bonos UF'] df_inter = query_by_daterange("inversion_internacional", start_date, end_date).dropna() df_ex = query_by_daterange("inversion_internacional", start_date, end_date).dropna() df_ex = df_ex[df_ex['Nombre'] == 'INVERSIÓN EXTRANJERA'] # plots patrimonio_total = plots.patrimonio_ajustado(df_vf, df_q, usdclp, True) patrimonio_afps = plots.patrimonio_ajustado(df_vf, df_q, usdclp, False) inversiones_total = plots.bar_inversion(df_nacio, df_inter, 'TOTAL') inter_hedge = plots.fig_hedge(df_inter, dfc, dfv, df_fn, usdclp, True) inter_hedge_total = plots.fig_hedge_total(df_inter, dfc, dfv, df_fn, usdclp, True) inversiones_nacional = plots.bar_inversion_nacional(df_nacio, 'TOTAL') inversiones_internacional = plots.bar_inversion_internacional( df_inter, 'TOTAL') inversiones_nacional_monedas = plots.bar_inversion_nacional_monedas( df_bonos_clp, df_bonos_uf, 'TOTAL') extranjeros_total = plots.fig_total_ex_fwd(df_ex, dfc, dfv, df_fn) extranjeros_fondos = plots.fig_inversiones(df_inter, 'INVERSIÓN EXTRANJERA', False) forwards_n = plots.fig_forwards_nacional(dfc, dfv, df_fn, usdclp, True) return patrimonio_total, patrimonio_afps, inversiones_total, inter_hedge_total, inter_hedge, inversiones_nacional, inversiones_nacional_monedas, inversiones_internacional, extranjeros_total, extranjeros_fondos, forwards_n
def update_output_ex_rf(value, start_date, end_date): flag = "MMUSD" if value is not None: if len(value) != 0: flag = "porcentaje" df_inter = query_by_daterange("inversion_internacional", start_date, end_date).dropna() fig = plots.fig_inversiones(df_inter, 'RENTA FIJA', flag) return fig
def update_output_dp(value, start_date, end_date): flag = "MMUSD" if value is not None: if len(value) != 0: flag = "porcentaje" # dataset df_nacio = query_by_daterange("inversion_nacional", start_date, end_date).dropna() fig = plots.fig_inversiones(df_nacio, 'Depósitos a Plazo', flag) return fig
def update_output(value, start_date, end_date): flag = "MMUSD" if value is not None: if len(value) != 0: flag = "porcentaje" # dataset df_nacio = query_by_daterange("inversion_nacional", start_date, end_date).dropna() fig = plots.fig_inversiones(df_nacio, 'INVERSIÓN NACIONAL TOTAL', flag) return fig
def update_fig_inver(start_date, end_date): df_total = query_by_daterange("inversion_total", start_date, end_date).dropna() fig = plots.fig_inversiones(df_total, 'TOTAL ACTIVOS', 'MMUSD') return fig