fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Cost/Risk Optimization

5 algorithms in Execution and Transaction Cost Analysis · 5 with asserted arithmetic.

In this family#

  1. Almgren-Chriss Optimal Execution verified

    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.

    almgrenChrissOptimalExecution(input)
  2. Implementation-Shortfall Execution verified

    Minimises total shortfall against the arrival price, including the opportunity cost of quantity that never executes. Unexecuted quantity is a real cost, and a strategy measured only on filled shares hides it.

    implementationShortfallExecution(input)
  3. Arrival-Price Execution verified

    Benchmarks against the price at the moment the decision was made, which front-loads execution. The most demanding common benchmark, because every second of delay is measured against it.

    arrivalPriceExecution(input)
  4. Liquidity-Seeking Execution verified

    Trades opportunistically when liquidity appears rather than on a schedule. Completion time is uncertain by construction — the strategy trades schedule certainty for better prices.

    liquiditySeekingExecution(input)
  5. Opportunistic Dark-Pool Execution verified

    Walks a list of dark opportunities in order and, for each one, either plans a lot-aligned exposure or records the first gate that refused it: the fallback window has arrived, firm probability is below the threshold, price improvement is below the threshold, the indicated size is under the minimum, or the dark cap is exhausted. Everything left over is reported as lit fallback quantity. The gating is deterministic arithmetic; no fill rate, adverse-selection cost or reversion is estimated, and no venue is chosen.

    opportunisticDarkPoolExecution(input)

What they share#

Every topic here is a record-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { almgrenChrissOptimalExecution } from "fintech-algorithms/execution-and-transaction-cost-analysis/cost-risk-optimization/almgren-chriss-optimal-execution";
import { implementationShortfallExecution } from "fintech-algorithms/execution-and-transaction-cost-analysis/cost-risk-optimization/implementation-shortfall-execution";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Execution and Transaction Cost Analysis collects 9 algorithms across 2 families. For the concept behind this family rather than the call signatures, see the concept guides.