def getinflations(inflations=ml_infl): """Normalize and average all inflation measures.""" # We will take the average of indexes after their # current value is set to 1 for equal weighting. inflsum = getdata_fred(inflations[0]) inflsum = inflsum / float(tools.tailvalue(inflsum)) for i in inflations[1:]: infl = getdata_fred(i) infl = infl / float(tools.tailvalue(infl)) inflsum += infl return inflsum / len(inflations)
def getinflations(inflations=ml_infl): '''Normalize and average all inflation measures.''' # We will take the average of indexes after their # current value is set to 1 for equal weighting. inflsum = getdata_fred(inflations[0]) inflsum = inflsum / float(tools.tailvalue(inflsum)) for i in inflations[1:]: infl = getdata_fred(i) infl = infl / float(tools.tailvalue(infl)) inflsum += infl return inflsum / len(inflations)
def getm4infleu(): """Normalize and average Eurozone Consumer Prices.""" # FRED carries only NSA data from Eurostat, # so we shall use Holt-Winters levels. cpiall = getdata_fred("CP0000EZ17M086NEST") # ^for 17 countries. holtall = ts.holtlevel(cpiall) normall = holtall / float(tools.tailvalue(holtall)) return normall
def getdeflator(inflation=m4infl): """Construct a de-inflation dataframe suitable as multiplier.""" # Usually we encounter numbers which have been deflated to dollars # of some arbitrary year (where the value is probably 100). # Here we set the present to 1, while past values have increasing # multiplicative "returns" which will yield current dollars. infl = getfred(inflation) lastin = tools.tailvalue(infl) return float(lastin) / infl
def getm4infleu(): '''Normalize and average Eurozone Consumer Prices.''' # FRED carries only NSA data from Eurostat, # so we shall use Holt-Winters levels. cpiall = getdata_fred('CP0000EZ17M086NEST') # ^for 17 countries. holtall = ts.holtlevel(cpiall) normall = holtall / float(tools.tailvalue(holtall)) return normall
def getdeflator(inflation=m4infl): '''Construct a de-inflation dataframe suitable as multiplier.''' # Usually we encounter numbers which have been deflated to dollars # of some arbitrary year (where the value is probably 100). # Here we set the present to 1, while past values have increasing # multiplicative "returns" which will yield current dollars. infl = getfred(inflation) lastin = tools.tailvalue(infl) return float(lastin) / infl