bayesline.api.equity.AsyncOptimizerApi#
- class bayesline.api.equity.AsyncOptimizerApi#
API for optimizing portfolios.
This abstract base class defines the interface for optimization operations.
- __init__()#
Methods
__init__()optimize(as_of)Get the optimized version of the configured portfolios.
optimize_as_task(as_of)Get the optimized version of the configured portfolios as a task.
Attributes
Get the settings for this optimization problem.
- abstract property settings: OptimizerSettings#
Get the settings for this optimization problem.
Returns#
- OptimizerSettings
The settings for this optimization problem.
- abstractmethod async optimize(as_of: str | date | datetime) AsyncOptimizationResult#
Get the optimized version of the configured portfolios.
A portfolio that cannot be optimized, for whatever reason, is reported in the result with an
errorstatus rather than raised; raises only for errors that invalidate the optimization problem as a whole.Upstream inputs (portfolio holdings, model exposures) are computed on demand and cached, so a call sharing its inputs with reports that already ran is fast while a cold cache can make it slow.
Parameters#
- as_ofDateLike
Date to start optimizing from.
Returns#
- AsyncOptimizationResult
The per-portfolio results of the defined optimization problem.
- abstractmethod async optimize_as_task(as_of: str | date | datetime) AsyncTask[AsyncOptimizationResult]#
Get the optimized version of the configured portfolios as a task.
The returned task is not guaranteed to defer the solve: an implementation may run it to completion before handing back an already-resolved task, in which case this call takes as long as
optimizewould.Parameters#
- as_ofDateLike
Date to start optimizing from.
Returns#
- AsyncTask[OptimizationResult]
The per-portfolio results of the defined optimization problem as a task.