发布

  • 17874 be0ad6cb70

    Fix MaximumSharpeRatioPortfolioOptimizer to maximize the Sharpe ratio (#9560)

    frostbyte_neo 发布于 2026-06-25 17:20:48 +00:00 | 58 次提交 在此版本后已推送到 master

    • Fix MaximumSharpeRatioPortfolioOptimizer to maximize the Sharpe ratio

    The optimizer fixed the portfolio return to the equal-weight return
    ((µ − r_f)ᵀw = k) and minimized variance, which collapsed it to a
    minimum-variance optimizer instead of maximizing the Sharpe ratio.

    Python now maximizes (µ − r_f)ᵀw / √(wᵀΣw) directly with SLSQP, keeping
    the budget constraint Σw = 1 and the per-weight bounds. C# applies the
    Charnes-Cooper substitution y = κw, minimizing yᵀΣy subject to
    (µ − r_f)ᵀy = 1 and recovering w = y / (1ᵀy); the per-weight bounds are
    written as linear constraints in y (yᵢ − up·(1ᵀy) ≤ 0, yᵢ − lw·(1ᵀy) ≥ 0)
    so the problem stays a convex QP and the [lower, upper] range is honored.

    Both languages reach the same optimum, and the unit-test expectations are
    updated to the corrected weights.

    Addresses QuantConnect/Lean#9322

    • Add property-based test that the optimizer maximizes the Sharpe ratio

    • Cover all well-defined cases in the Sharpe optimality test

    • Bound the optimality test above by the tangency Sharpe ceiling

    下载附件