Skip to content
SeerDocsWebsite
Browse documentation

Developer documentation API v1

Portfolio construction and optimization

Transform forecasts into constrained candidate allocations without assuming execution.

The feasible set constrains the decision

Two risky-asset weights are bounded by concentration and cash constraints. A marker shows a feasible illustrative allocation.
Illustrative two-asset feasible region: each weight ≤0.6 and total risky exposure ≤0.8. The marked 0.55/0.25 allocation leaves 20% cash; it is not an optimized recommendation. View full size ↗

State vector and valuation

The account snapshot contains positions, valuation observations, available cash, committed capital and pending actions at a common cutoff. Each position maps to its canonical instrument and valuation currency. The snapshot revision binds the optimization input to a reproducible state.

Gross exposure, net exposure, leverage and concentration describe different properties. Pending orders affect available capital and possible future holdings even before settlement. The optimization’s current-weight vector therefore has an explicit treatment of unsettled and committed amounts.

Illustrative long-only allocation problem

w denotes risky-asset weights; residual weight is cash with zero modeled return in this simplified objective. μ and Σ use the same horizon. λ controls risk aversion; κ is a proportional turnover-cost approximation; w₀ is current weight; u is concentration cap; c_min is minimum cash; τ bounds two-way absolute turnover; B maps factor or sector exposures. The objective combines expected return, covariance risk and a proportional turnover penalty. Execution feasibility and cash needed for costs require subsequent checks.

max⁡wμ⊤w−λ2w⊤Σw−κ∥w−w0∥1s.t.0≤wi≤ui,1⊤w≤1−cmin⁡∥w−w0∥1≤τ,L≤Bw≤U\begin{aligned}\max_w\quad&\mu^\top w-\frac\lambda2 w^\top\Sigma w-\kappa\|w-w_0\|_1\\ \text{s.t.}\quad&0\le w_i\le u_i,\quad\mathbf1^\top w\le1-c_{\min}\\ &\|w-w_0\|_1\le\tau,\quad L\le Bw\le U\end{aligned}

Allocation request

POST /v1/portfolio-proposals accepts a computation job. The objective selects the solver contract; constraints apply to the referenced account snapshot and risk-model revision.

json
{
  "account_snapshot_id": "acctsnap_example_1",
  "forecast_ids": [
    "fc_example_1"
  ],
  "objective": "mean_variance_with_turnover",
  "constraints": {
    "long_only": true,
    "max_weight_bps": 2000,
    "min_cash_bps": 1000,
    "max_turnover_bps": 3000
  },
  "risk_model_revision": "risk-example-r1",
  "objective_parameters": {
    "risk_aversion": 4,
    "turnover_penalty": 0.001,
    "solver_tolerance": 1e-08
  }
}

Feasibility and sensitivity

The solver result contains termination status, objective value, feasibility residuals and constraint diagnostics. Infeasible or numerically invalid solutions do not become executable allocations. Hard constraints remain binding rather than being relaxed silently.

Expected returns, covariance estimates and transaction-cost assumptions can materially change the optimum. Sensitivity analysis exposes this instability through perturbations and comparisons with the current portfolio and a constrained baseline. A high objective value is meaningful only within the chosen horizon, units and uncertainty assumptions.

Discretization and execution preflight

Continuous weights become venue-valid quantities using current prices, lot sizes and explicit costs. Discretization can move a feasible continuous solution outside a cash or exposure constraint, so the executable proposal carries a second feasibility check.

The proposal is bound to the account snapshot, policy and quote revisions used to construct it. Changes in balances, outstanding orders, quotes or permissions trigger revalidation before dispatch. Target weights, admitted orders and realized holdings remain different stages of the same decision.

Primal feasibility residual

g_j(w)≤0 denotes an inequality and Aw=b an equality. Constraints are normalized to compatible scales before their residuals are compared. A solver’s tolerance is interpreted in that normalization; a small numerical residual does not excuse a material cash shortfall after rounding.

εprimal=max⁡(0,max⁡jgj(w),∥Aw−b∥∞)\varepsilon_{\mathrm{primal}}=\max\left(0,\max_j g_j(w),\|Aw-b\|_{\infty}\right)

Objective scaling and regularization

Expected return, covariance and turnover are evaluated over the same horizon. Weights are dimensionless; μ is return per unit weight and Σ contains return-squared covariance. Risk aversion converts the quadratic penalty to the objective scale, while the turnover coefficient represents a proportional cost approximation.

The L1 turnover term is nondifferentiable at unchanged holdings and favors sparse adjustments. Its subgradient belongs to [−1,1] where a weight does not change. This makes “do nothing” an economically meaningful region of the optimization rather than a missing decision. Covariance regularization and exposure limits reduce sensitivity but do not eliminate forecast estimation error.

Stationarity of a constrained allocation

This is the stationarity condition for the minimization form of the convex mean-variance objective. Together with feasibility, nonnegative inequality multipliers and complementary slackness, it characterizes an optimum under the usual convexity and constraint qualifications. ν and η are dual variables; their values quantify local sensitivity to constraint changes, not confidence in future returns. Local sensitivity can be nonunique when the optimum or multipliers are nonunique.

0∈λΣw−μ+κ∂∥w−w0∥1+∑jνj∇gj(w)+A⊤η0\in\lambda\Sigma w-\mu+\kappa\partial\|w-w_0\|_1+\sum_j\nu_j\nabla g_j(w)+A^\top\eta

Infeasible allocation result

The portfolio_proposal artifact carries a discriminated calculation result. Failed solves contain diagnostics and no target weights. Only an optimal result includes weights, cash_weight, objective_value and primal_residual.

json
{
  "proposal_id": "allocation_example_2",
  "proposal_revision": 1,
  "account_snapshot_id": "acctsnap_example_1",
  "risk_model_revision": "risk-example-r1",
  "solver_status": "infeasible",
  "error_code": "CONSTRAINTS_INFEASIBLE",
  "constraint_diagnostics": [
    {
      "constraint": "minimum_cash",
      "residual": 0.05,
      "tolerance": 1e-08,
      "binding": false
    }
  ]
}
SeerTechnical reference · 1 November 2026