Almgren-Chriss Optimal Execution
Install and import
npm install fintech-algorithmsimport { almgrenChrissOptimalExecution } from "fintech-algorithms/execution-and-transaction-cost-analysis/cost-risk-optimization/almgren-chriss-optimal-execution";Signature
almgrenChrissOptimalExecution(input)The canonical optimal execution trajectory: trades off market impact against the risk of holding the position longer. Risk aversion is the single parameter that shapes the answer — at zero it degenerates to TWAP.
Parameters
| Name | Type | Notes |
|---|---|---|
input | AlmgrenChrissInput | Total quantity, horizon, volatility, temporary and permanent impact coefficients, and the risk-aversion parameter. The impact coefficients are estimates, and the trajectory is only as good as they are. |
Returns
{ trajectory, expected_cost, cost_variance, efficient_frontier_point, … }
The trading trajectory with expected cost **and** its variance — reporting cost alone hides the trade being made.
Errors
- When risk aversion is negative, or an impact coefficient is not positive — throws
Complexity: time O(steps),
space O(steps).
Worked example
executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.
Input
{
"total_quantity": 12000,
"interval_count": 12,
"lot_size": 100,
"temporary_impact_weight": 100,
"inventory_risk_weight": 1
}Call
almgrenChrissOptimalExecution(input)Returns
object with 13 fields: total_quantity, interval_count, lot_size, temporary_impact_weight, inventory_risk_weight, kappa, scheduled_quantity, remaining_quantity, …
{
"total_quantity": 12000,
"interval_count": 12,
"lot_size": 100,
"temporary_impact_weight": 100,
"inventory_risk_weight": 1,
"kappa": 0.099958380139,
"scheduled_quantity": 12000,
"remaining_quantity": 0,
"temporary_impact_score": 1248000000,
"inventory_risk_score": 410470000,
"objective_score": 1658470000,
"schedule": [
{
"interval": 1,
"target_quantity": 1400,
"target_remaining_quantity": 10600,
"temporary_impact_score": 196000000,
"inventory_risk_score": 112360000
},
{
"interval": 2,
"target_quantity": 1300,
"target_remaining_quantity": 9300,
"temporary_impact_score": 169000000,
"inventory_risk_score": 86490000
},
{
"interval": 3,
"target_quantity": 1200,
"target_remaining_quantity": 8100,
"temporary_impact_score": 144000000,
"inventory_risk_score": 65610000
}
],
"state": "risk-adjusted"
}Other exports
This module also exports
implementationShortfallExecution, arrivalPriceExecution, liquiditySeekingExecution, opportunisticDarkPoolExecution, calculate. Every module additionally exports run as an alias of its
primary function, and a meta object carrying its catalog id, domain, family,
shape and article URL.
Diagrams
How it works
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References
- Optimal Execution of Portfolio Transactions — Robert Almgren and Neil Chriss
- Staff Report on Algorithmic Trading in U.S. Capital Markets — Staff of the U.S. Securities and Exchange Commission
- FIX Algorithmic Trading Definition Language Online Specification — FIX Trading Community
- Evidence boundary