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
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)
def calculate_sharp(returns): msharp = MovingSharp(len(returns)) for ret in returns: msharp.push({'ret': ret, 'riskFree': 0.}) return msharp.value * math.sqrt(50)
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)