Transaction-Cost-Aware Optimization
Install and import#
npm install fintech-algorithmsimport { optimizeTransactionCostAware } from "fintech-algorithms/portfolio-construction/practical-constraints/transaction-cost-aware-optimization";Signature#
optimizeTransactionCostAware(mu, covariance, lambdaRisk, x0, buyCost, sellCost, options)Parameters#
| Name | Type | Notes |
|---|---|---|
mu | unknown | |
covariance | unknown | |
lambdaRisk | unknown | |
x0 | unknown | |
buyCost | unknown | |
sellCost | unknown | |
options | { cashIndex?: number; costHorizon?: string; maxIterations?: number } | optional |
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#
[0.08, 0.04, 0][
[0.04, 0, 0],
[0, 0.01, 0],
[0, 0, 0]
]0.0005[600, 400, 100][0.001, 0.002, 0][0.001, 0.002, 0]{
"cashIndex": 2
}Call#
optimizeTransactionCostAware(mu, covariance, lambdaRisk, x0, buyCost, sellCost, options)Returns#
object with 15 fields: status, weights, trade, buy, sell, directCost, auxiliaryCost, budgetResidual, …
{
"status": "optimal",
"weights": [957.3853839647959, 141.74071207539012, 0],
"trade": [357.3853839647959, -258.2592879246099, -100],
"buy": [357.3853839647959, 0, 0],
"sell": [0, 258.2592879246099, 100],
"directCost": 0.8739039598140157,
"auxiliaryCost": 0.8739039598140157,
"budgetResidual": 0,
"objective": 62.95436762449867,
"iterations": 523,
"cashIndex": 2,
"costHorizon": "per-rebalance",
"currentWealth": 1100,
"cashBalance": 0
}Showing 14 of 15 fields.
Other exports#
This module also exports
auditTradeParts. 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#
- MOSEK Portfolio Optimization Cookbook, Chapter 6 — MOSEK ApS.
- Boyd et al., Multi-Period Trading via Convex Optimization — Stephen Boyd and collaborators.
- Google discovery status