Forked from StuartGordonReid/PartialMomentsAdjustedReturns.py
Created
January 5, 2021 00:47
-
-
Save wapebira/8980d87c1912272de048b1ae0c38f015 to your computer and use it in GitHub Desktop.
Risk adjusted returns based on Lower Partial Moments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Note that this Gist uses functions made available in another Gist - | |
https://gist.github.com/StuartGordonReid/67a1ec4fbc8a84c0e856 | |
""" | |
def omega_ratio(er, returns, rf, target=0): | |
return (er - rf) / lpm(returns, target, 1) | |
def sortino_ratio(er, returns, rf, target=0): | |
return (er - rf) / math.sqrt(lpm(returns, target, 2)) | |
def kappa_three_ratio(er, returns, rf, target=0): | |
return (er - rf) / math.pow(lpm(returns, target, 3), float(1/3)) | |
def gain_loss_ratio(returns, target=0): | |
return hpm(returns, target, 1) / lpm(returns, target, 1) | |
def upside_potential_ratio(returns, target=0): | |
return hpm(returns, target, 1) / math.sqrt(lpm(returns, target, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment