Exemple #1
0
def get_carteras_fondos(date_anterior):
    path_rf = ".\\Querys\\Bonos.sql"
    path_if = ".\\Querys\\Depositos.sql"
    query_rf = fs.read_file(path=path_rf).replace("AUTODATE", str(date_anterior))
    query_if = fs.read_file(path=path_if).replace("AUTODATE", str(date_anterior))

    cartera_fondos_rf = fs.get_frame_sql_user(server="Puyehue",
                                    database="MesaInversiones",
                                    username="******",
                                    password="******",
                                    query=query_rf)
    cartera_fondos_rf.set_index(["codigo_ins"], inplace=True)

    cartera_fondos_if = fs.get_frame_sql_user(server="Puyehue",
                                    database="MesaInversiones",
                                    username="******",
                                    password="******",
                                    query=query_if)


    cartera_fondos_if = comput_nemotecnico_depositos(cartera_fondos_if, perf_att=False)

    cartera_fondos_if.index.name='codigo_ins'
    cartera_fondos = cartera_fondos_rf.append(cartera_fondos_if)
    cartera_fondos['weight'] = cartera_fondos['weight'].astype('float64') 
    
    return cartera_fondos
Exemple #2
0
def getInfoIndicesAFP():

    

	path="queryAFPs.sql"
	query = lib.read_file(path=path)
	sqlQuery="SELECT INDEX_ID FROM INDICES_ESTATICA WHERE NOMBRE_INDEX LIKE '%FONDO E%'"
	vals =  lib.get_frame_sql_user(server="Puyehue",
        	                   database="MesaInversiones",
    	                       username="******",
    	                       password="******", 
    	                       query=query)
	return vals
Exemple #3
0
def get_leverage(date):

    path = ".\\Querys\\Leverage.sql"
    query = fs.read_file(path=path).replace("AUTODATE", str(date))

    df_leverage = fs.get_frame_sql_user(server="Puyehue",
                                    database="MesaInversiones",
                                    username="******",
                                    password="******",
                                    query=query)

    df_leverage['monto_pactado'] = df_leverage['monto_pactado'].astype('float64')
    df_leverage = df_leverage.set_index('codigo_fdo')

    return df_leverage
Exemple #4
0
def get_posiciones_forwards(date):

    path = ".\\Querys\\Forwards.sql"
    query = fs.read_file(path=path).replace("AUTODATE", str(date))

    df_forwards = fs.get_frame_sql_user(server="Puyehue",
                                    database="MesaInversiones",
                                    username="******",
                                    password="******",
                                    query=query)

    df_forwards = compute_forwards_net_positions(df_forwards)
    df_forwards = df_forwards.set_index('codigo_fdo')

    return df_forwards
Exemple #5
0
def get_funds_aum(date):

    path = ".\\Querys\\AUM.sql"
    query = fs.read_file(path=path).replace("AUTODATE", str(date))

    df_funds_aum = fs.get_frame_sql_user(server="Puyehue",
                                    database="MesaInversiones",
                                    username="******",
                                    password="******",
                                    query=query)

    df_funds_aum['AUM'] = df_funds_aum['AUM'].astype('float64')
    df_funds_aum = df_funds_aum.set_index('codigo_fdo')

    return df_funds_aum
Exemple #6
0
def get_currency_type(date, df_risk):

    date_anterior = utiles.get_fecha_habil_anterior(date)
    path = ".\\querys\\mapping_cinta.sql"
    query = fs.read_file(path=path).replace("AUTODATE", str(date_anterior))
    cinta_ra = fs.get_frame_sql_user(server="Puyehue",
                                    database="MesaInversiones",
                                    username="******",
                                    password="******",
                                    query=query)

    cinta_ra.set_index(["Codigo_Ins"], inplace=True)

    df_mapped = df_risk.merge(cinta_ra, how='left', left_index=True, right_index=True)

    
    return df_mapped