def load_gbp(): """ Return cash rate for GBP """ libor = DataReader(CashFile.GBP_3M_LIBOR.value, 'fred', START_DATE) libor_m = DataReader(CashFile.GBP_3M_LIBOR_M.value, "fred", START_DATE) policy_rate = DataReader(CashFile.GBP_POLICY_RATE.value, "fred", START_DATE) data = (pd.concat((policy_rate[:"1969-12"].fillna(method="pad"), libor_m['1970':"1985"].fillna(method="pad"), libor.fillna(method="pad")), axis=1).sum(axis=1).rename("cash_rate_gbp")) return data
def load_gbp(): """ Return cash rate for GBP """ libor = DataReader(CashFile.GBP_3M_LIBOR.value, 'fred', START_DATE) libor_m = DataReader(CashFile.GBP_3M_LIBOR_M.value, "fred", START_DATE) policy_rate = DataReader(CashFile.GBP_POLICY_RATE.value, "fred", START_DATE) data = (pd.concat((policy_rate[:"1969-12"].fillna(method="pad"), libor_m['1970':"1985"].fillna(method="pad"), libor.fillna(method="pad")), axis=1) .sum(axis=1).rename("cash_rate_gbp")) return data
def get_fx_rates(currency): fx_rates_info = FxRatesInfo[currency].value if fx_rates_info.data_source == 'quandl': fx_rates = quandl.get(fx_rates_info.data_name, api_key=quandl_token) fx_rates = fx_rates['Rate'] else: fx_rates = DataReader(fx_rates_info.data_name, fx_rates_info.data_source, START_DATE) fx_rates = fx_rates.squeeze() fx_rates = (fx_rates.fillna(method='pad').rename( fx_rates_info.fx_rates_name)) return fx_rates