Skip to content

Instantly share code, notes, and snippets.

@raddy
Last active September 16, 2018 18:30
Show Gist options
  • Select an option

  • Save raddy/d55f16cafc529ee2d53334b8b535a4d9 to your computer and use it in GitHub Desktop.

Select an option

Save raddy/d55f16cafc529ee2d53334b8b535a4d9 to your computer and use it in GitHub Desktop.
Optimal Kelly Fraction 4 Moments
def kelly_four_moments(mu, sigma, c3, c4):
return (c3/(3*c4) - (c3**2/c4**2 - 3*(mu**2 + sigma**2)/c4)/(3*(-c3**3/c4**3 + 9*c3*(mu**2 + sigma**2)/(2*c4**2) + np.sqrt(-4*(c3**2/c4**2 - 3*(mu**2 + sigma**2)/c4)**3
+ (-2*c3**3/c4**3 + 9*c3*(mu**2 + sigma**2)/c4**2 - 27*mu/c4)**2)/2 - 27*mu/(2*c4))**(1/3))
- (-c3**3/c4**3 + 9*c3*(mu**2 + sigma**2)/(2*c4**2) + np.sqrt(-4*(c3**2/c4**2 - 3*(mu**2 + sigma**2)/c4)**3
+ (-2*c3**3/c4**3 + 9*c3*(mu**2 + sigma**2)/c4**2 - 27*mu/c4)**2)/2 - 27*mu/(2*c4))**(1/3)/3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment