Skip to content

Instantly share code, notes, and snippets.

@StuartGordonReid
Created June 12, 2015 13:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save StuartGordonReid/7edbaae13eafed0167b3 to your computer and use it in GitHub Desktop.
Save StuartGordonReid/7edbaae13eafed0167b3 to your computer and use it in GitHub Desktop.
Risk adjusted returns based on Value at Risk
"""
Note that this Gist uses functions made available in another Gist -
https://gist.github.com/StuartGordonReid/67a1ec4fbc8a84c0e856
"""
def excess_var(er, returns, rf, alpha):
return (er - rf) / var(returns, alpha)
def conditional_sharpe_ratio(er, returns, rf, alpha):
return (er - rf) / cvar(returns, alpha)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment