Exemplo n.º 1
0
 def calculateSingalWindowSharp(returns, window, factor):
     res = []
     rscalc = MovingSharp(window=int(window * APPROX_BDAYS_PER_MONTH))
     for ret in returns:
         rscalc.push({'ret': ret, 'riskFree': 0})
         try:
             # in PyFin, sharp is not annualized
             res.append(rscalc.result() * sqrt(APPROX_BDAYS_PER_YEAR / factor))
         except ZeroDivisionError:
             res.append(np.nan)
     return res
Exemplo n.º 2
0
 def calculateSingalWindowSharp(returns, window, factor):
     res = []
     rscalc = MovingSharp(window=int(window * APPROX_BDAYS_PER_MONTH))
     for ret in returns:
         rscalc.push({'ret': ret, 'riskFree': 0})
         try:
             # in PyFin, sharp is not annualized
             res.append(rscalc.result() *
                        sqrt(APPROX_BDAYS_PER_YEAR / factor))
         except ZeroDivisionError:
             res.append(np.nan)
     return res
Exemplo n.º 3
0
def calculate_sharp(returns, multplier=50):
    msharp = MovingSharp(len(returns), x='ret', y='riskFree')
    for ret in returns:
        msharp.push({'ret': ret, 'riskFree': 0.})
    return msharp.value * math.sqrt(multplier)
Exemplo n.º 4
0
def calculate_sharp(returns):
    msharp = MovingSharp(len(returns))
    for ret in returns:
        msharp.push({'ret': ret, 'riskFree': 0.})
    return msharp.value * math.sqrt(50)
Exemplo n.º 5
0
def calculate_sharp(returns, multplier=50):
    msharp = MovingSharp(len(returns))
    for ret in returns:
        msharp.push({"ret": ret, "riskFree": 0.0})
    return msharp.value * math.sqrt(multplier)