Created
June 12, 2015 13:54
-
-
Save StuartGordonReid/6c1b4281e6662cad397f to your computer and use it in GitHub Desktop.
Risk adjusted returns based on Lower Partial Moments
This file contains 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