Budget Constraints

PortfolioOptimisers.BudgetRangeType
struct BudgetRange{__T_lb, __T_ub} <: BudgetEstimator

Bounds the sum of the portfolio weights inside a closed interval, rather than pinning it to one value.

At least one of lb or ub must be given; the absent side is left unbounded. The same type serves the net budget bgt, the short budget sbgt and the gross budget gbgt.

Fields

  • lb: Lower bound.
  • ub: Upper bound.

Constructors

BudgetRange(; lb::Option{<:Number} = 1.0, ub::Option{<:Number} = 1.0) -> BudgetRange

Keywords correspond to the struct's fields.

Validation

  • At least one of lb, ub must not be nothing.
  • lb and ub must be finite.
  • lb <= ub when both are provided.

Related

source
PortfolioOptimisers.BudgetCostsType
struct BudgetCosts{__T_bgt, __T_w, __T_vp, __T_vn, __T_up, __T_un} <: BudgetCostEstimator

Charges the portfolio budget for transaction costs that grow linearly with the traded volume.

Models the cost of the bid-ask spread, of slippage, of a borrowing charge, or of a management fee. The cost is charged against the budget: the weights and their costs must together meet bgt, so a portfolio that trades more may hold less.

Mathematical definition

\[\begin{align} \boldsymbol{1}^\intercal \boldsymbol{w} + \boldsymbol{v}_p^\intercal \boldsymbol{w}_p + \boldsymbol{v}_n^\intercal \boldsymbol{w}_n &\in [k\,\mathrm{lb},\; k\,\mathrm{ub}]\,, \\ \boldsymbol{w} - \boldsymbol{w}_0 &= \boldsymbol{w}_p - \boldsymbol{w}_n\,, \\ \boldsymbol{w}_p &\leq \boldsymbol{u}_p\,, \\ \boldsymbol{w}_n &\leq \boldsymbol{u}_n\,, \\ \boldsymbol{w}_p,\; \boldsymbol{w}_n &\geq \boldsymbol{0}\,. \end{align}\]

Where:

  • $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.
  • $k$: Budget scaling / homogenisation variable.
  • $\boldsymbol{w}_0$: Reference portfolio the trade starts from (w).
  • $\boldsymbol{w}_p$, $\boldsymbol{w}_n$: Positive and negative weight increments.
  • $\boldsymbol{v}_p$, $\boldsymbol{v}_n$: Cost coefficient vectors for positive and negative changes.
  • $\boldsymbol{u}_p$, $\boldsymbol{u}_n$: Upper limits on the positive and negative increments.
  • $\mathrm{lb}$, $\mathrm{ub}$: Lower and upper budget bounds. A scalar bgt pins them together.

A pinned bgt = 1.0 and a MaximumReturn objective reproduce the identity to 7.1e-9 on a five-asset sample: sum(w) + 0.01 * sum(abs.(w - w0)) lands on 0.999999992894044.

Warning

$\boldsymbol{w}_p$ and $\boldsymbol{w}_n$ are not forced to be complementary, so the relaxation is exact only while the objective prefers a larger invested budget. Under MinimumRisk it does not: a larger cost shrinks $\boldsymbol{1}^\intercal \boldsymbol{w}$ and so shrinks the risk, and the solver inflates both increments to their up and un caps. On the sample above, minimising the variance gives sum(w) = 0.9514 with a charged cost of 0.0486 against a traded cost of 0.0014. Give the return term a lower bound through settings.lb, exactly as the source formulation does, whenever the objective minimises a risk measure.

Fields

  • bgt: Budget target or range that the weights and their trading costs must meet together.
  • w: Portfolio weights vector assets × 1.
  • vp: Cost coefficients for positive weight changes. Non-negative.
  • vn: Cost coefficients for negative weight changes. Non-negative.
  • up: Upper limit on positive weight changes. Non-negative.
  • un: Upper limit on negative weight changes. Non-negative.

Constructors

BudgetCosts(;    bgt::Num_BgtRg = 1.0,    w::VecNum,    vp::Num_VecNum = 1.0,    vn::Num_VecNum = 1.0,    up::Num_VecNum = 1.0,    un::Num_VecNum = 1.0) -> BudgetCosts

Keywords correspond to the struct's fields.

Validation

  • !isempty(w).
  • If vp is a vector: !isempty(vp) and all elements >= 0. If scalar: >= 0.
  • If vn is a vector: !isempty(vn) and all elements >= 0. If scalar: >= 0.
  • If up is a vector: !isempty(up) and all elements >= 0. If scalar: >= 0.
  • If un is a vector: !isempty(un) and all elements >= 0. If scalar: >= 0.

View parameters

When port_opt_view is called on this type, the following @vprop-tagged fields are automatically subset to the selected indices:

Related

References

  • [5] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 9.1, equations 9.14 and 9.15.
source
PortfolioOptimisers.BudgetMarketImpactType
struct BudgetMarketImpact{__T_bgt, __T_w, __T_vp, __T_vn, __T_up, __T_un, __T_beta} <: BudgetCostEstimator

Charges the portfolio budget and the return for market impact costs that follow an empirical power law.

Extends BudgetCosts with a power cone, so the charge grows as the traded volume raised to $1/\mathrm{beta}$. Unlike a linear cost, the charge is also subtracted from the return expression of every term whose settings.mic is true.

Mathematical definition

\[\begin{align} \boldsymbol{1}^\intercal \boldsymbol{w} + \boldsymbol{v}_p^\intercal \boldsymbol{\iota}_p + \boldsymbol{v}_n^\intercal \boldsymbol{\iota}_n &\in [k\,\mathrm{lb},\; k\,\mathrm{ub}]\,, \\ (\iota_{p,i},\; 1,\; w_{p,i}) &\in \mathcal{K}_{\mathrm{pow}}^\beta \quad \forall i = 1,\dots,N\,, \\ (\iota_{n,i},\; 1,\; w_{n,i}) &\in \mathcal{K}_{\mathrm{pow}}^\beta \quad \forall i = 1,\dots,N\,, \\ \boldsymbol{w} - \boldsymbol{w}_0 &= \boldsymbol{w}_p - \boldsymbol{w}_n\,, \\ \boldsymbol{w}_p &\leq \boldsymbol{u}_p\,, \\ \boldsymbol{w}_n &\leq \boldsymbol{u}_n\,, \\ \boldsymbol{w}_p,\; \boldsymbol{w}_n &\geq \boldsymbol{0}\,. \end{align}\]

Where:

  • $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.
  • $k$: Budget scaling / homogenisation variable.
  • $N$: Number of assets.
  • $\boldsymbol{w}_0$: Reference portfolio the trade starts from (w).
  • $\boldsymbol{w}_p$, $\boldsymbol{w}_n$: Positive and negative weight increments.
  • $\boldsymbol{\iota}_p$, $\boldsymbol{\iota}_n$: Auxiliary variables the power cone bounds below by $w_p^{1/\beta}$ and $w_n^{1/\beta}$.
  • $\boldsymbol{v}_p$, $\boldsymbol{v}_n$: Market impact cost coefficients for positive and negative trades.
  • $\boldsymbol{u}_p$, $\boldsymbol{u}_n$: Upper limits on the positive and negative increments.
  • $\mathcal{K}_{\mathrm{pow}}^\beta$: Three-dimensional power cone of exponent $\beta$.
  • $\mathrm{lb}$, $\mathrm{ub}$: Lower and upper budget bounds. A scalar bgt pins them together.
Note

beta is the reciprocal of the power law's exponent. The cone gives $\iota_i \geq w_i^{1/\beta}$, so the default beta = 2/3 charges the volume raised to 3/2, the value the empirical literature reports. The cone needs 0 < beta < 1; the constructor refuses both endpoints, because a solver reports SLOW_PROGRESS on either.

A pinned bgt = 1.0 and a MaximumReturn objective reproduce the identity to 9.4e-10 on a five-asset sample: sum(w) + 0.01 * sum(abs.(w - w0) .^ 1.5) lands on 0.9999999990596528.

Warning

The auxiliary variables carry no upper bound, so the charge is exact only while the objective prefers a larger invested budget. Under MinimumRisk the solver treats them as riskless assets and concentrates the whole budget in them: on the sample above, minimising the variance gives sum(w) = 0.0051. Give the return term a lower bound through settings.lb, exactly as the source formulation instructs, whenever the objective minimises a risk measure.

Fields

  • bgt: Budget target or range that the weights and their trading costs must meet together.
  • w: Portfolio weights vector assets × 1.
  • vp: Cost coefficients for positive weight changes. Non-negative.
  • vn: Cost coefficients for negative weight changes. Non-negative.
  • up: Upper limit on positive weight changes. Non-negative.
  • un: Upper limit on negative weight changes. Non-negative.
  • beta: Reciprocal of the market impact exponent, 0 < beta < 1. The realised exponent is 1/beta.

Constructors

BudgetMarketImpact(;    bgt::Num_BgtRg = 1.0,    w::VecNum,    vp::Num_VecNum = 1.0,    vn::Num_VecNum = 1.0,    up::Num_VecNum = 1.0,    un::Num_VecNum = 1.0,    beta::Number = 2/3) -> BudgetMarketImpact

Keywords correspond to the struct's fields.

Validation

  • !isempty(w).
  • If vp is a vector: !isempty(vp) and all elements >= 0. If scalar: >= 0.
  • If vn is a vector: !isempty(vn) and all elements >= 0. If scalar: >= 0.
  • If up is a vector: !isempty(up) and all elements >= 0. If scalar: >= 0.
  • If un is a vector: !isempty(un) and all elements >= 0. If scalar: >= 0.
  • 0 < beta < 1.

View parameters

When port_opt_view is called on this type, the following @vprop-tagged fields are automatically subset to the selected indices:

Related

References

  • [5] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 9.3, equations 9.22 and 9.23.
  • [43] R. C. Grinold and R. N. Kahn. Active Portfolio Management: A Quantitative Approach for Producing Superior Returns and Controlling Risk. 2 Edition (McGraw-Hill, New York, 1999).
  • [130] B. Tóth, Y. Lempérière, C. Deremble, J. de Lataillade, J. Kockelkoren and J.-P. Bouchaud. Anomalous price impact and the critical nature of liquidity in financial markets. Physical Review X 1, 021006 (2011).
source

References

[5]
D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).
[43]
R. C. Grinold and R. N. Kahn. Active Portfolio Management: A Quantitative Approach for Producing Superior Returns and Controlling Risk. 2 Edition (McGraw-Hill, New York, 1999).
[130]
B. Tóth, Y. Lémperière, C. Deremble, J. de Lataillade, J. Kockelkoren and J.-P. Bouchaud. Anomalous Price Impact and the Critical Nature of Liquidity in Financial Markets. Physical Review X 1, 021006 (2011).