コード例 #1
0
ファイル: yi_fred.py プロジェクト: BadWizard/fecon235
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)
コード例 #2
0
ファイル: yi_fred.py プロジェクト: zehsilva/fecon235
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)
コード例 #3
0
ファイル: yi_fred.py プロジェクト: BadWizard/fecon235
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
コード例 #4
0
ファイル: yi_fred.py プロジェクト: BadWizard/fecon235
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
コード例 #5
0
ファイル: yi_fred.py プロジェクト: zehsilva/fecon235
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
コード例 #6
0
ファイル: yi_fred.py プロジェクト: zehsilva/fecon235
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