Module Position_sizing.Kelly

val full : mean:float -> variance:float -> float

Continuous-return Kelly fraction: f* = mean / variance.

Assumes log-normal returns; for normal returns the approximation is reasonable when |mean| is small compared to the standard deviation. Returns 0 if variance <= 0.

val fractional : mean:float -> variance:float -> fraction:float -> float

Fractional Kelly: fraction times full. Recommended default fraction = 0.25 — reduces variance ~93% while sacrificing only ~25% of geometric growth.

val from_winrate : win_prob:float -> win_loss_ratio:float -> float

Discrete-bet Kelly: f* = p − q/b where p = win_prob, q = 1 − p, b = win_loss_ratio. Returns 0 if win_loss_ratio <= 0.

val size_position : capital:float -> kelly_fraction:float -> price:float -> ?cap_pct:float -> unit -> float

Convert a Kelly fraction to a share count. cap_pct hard-caps the position at this fraction of capital (default 1.0). Negative or NaN fractions are floored to 0.