fintech-algorithms

Opportunistic Dark-Pool Execution

Install and import

bash
npm install fintech-algorithms
ts
import { opportunisticDarkPoolExecution } from "fintech-algorithms/execution-and-transaction-cost-analysis/cost-risk-optimization/opportunistic-dark-pool-execution";

Signature

opportunisticDarkPoolExecution(input)

Routes to non-displayed venues to avoid signalling. The counter-risk is adverse selection: filling in the dark exactly when the lit market is about to move against you, which the fill-rate and reversion outputs are there to expose.

Parameters

NameTypeNotes
inputDarkPoolInputQuantity, venue list with their fill characteristics, minimum acceptable quantity, and the reference price constraining acceptable fills.

Returns

{ routes, expected_fill_rate, adverse_selection_estimate, … }

Routing plan with expected fill rate and an adverse-selection estimate — the cost that dark execution trades for invisibility.

Errors

  • When no venue is supplied — throws

Complexity: time O(venues), space O(venues).

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

input
{
  "total_quantity": 6000,
  "lot_size": 100,
  "maximum_dark_fraction_bps": 6000,
  "minimum_firm_probability_bps": 7500,
  "minimum_price_improvement_atoms": 30,
  "minimum_execution_quantity": 300,
  "max_exposure_per_window": 1000,
  "fallback_window": 8,
  "dark_opportunities": [
    {
      "opportunity_id": "DK-01",
      "window": 1,
      "indicated_quantity": 500,
      "firm_probability_bps": 8200,
      "price_improvement_atoms": 50
    },
    {
      "opportunity_id": "DK-02",
      "window": 2,
      "indicated_quantity": 900,
      "firm_probability_bps": 7600,
      "price_improvement_atoms": 40
    },
    {
      "opportunity_id": "DK-03",
      "window": 3,
      "indicated_quantity": 300,
      "firm_probability_bps": 9100,
      "price_improvement_atoms": 60
    }
  ]
}

Call

opportunisticDarkPoolExecution(input)

Returns

object with 9 fields: total_quantity, maximum_dark_fraction_bps, dark_quantity_cap, planned_dark_exposure_quantity, lit_fallback_quantity, dark_opportunity_count, accepted_dark_window_count, opportunities, …

{
  "total_quantity": 6000,
  "maximum_dark_fraction_bps": 6000,
  "dark_quantity_cap": 3600,
  "planned_dark_exposure_quantity": 3300,
  "lit_fallback_quantity": 2700,
  "dark_opportunity_count": 10,
  "accepted_dark_window_count": 5,
  "opportunities": [
    {
      "opportunity_id": "DK-01",
      "window": 1,
      "indicated_quantity": 500,
      "firm_probability_bps": 8200,
      "price_improvement_atoms": 50,
      "planned_dark_exposure_quantity": 500,
      "reason": "expose-dark",
      "dark_cap_remaining_quantity": 3100
    },
    {
      "opportunity_id": "DK-02",
      "window": 2,
      "indicated_quantity": 900,
      "firm_probability_bps": 7600,
      "price_improvement_atoms": 40,
      "planned_dark_exposure_quantity": 900,
      "reason": "expose-dark",
      "dark_cap_remaining_quantity": 2200
    },
    {
      "opportunity_id": "DK-03",
      "window": 3,
      "indicated_quantity": 300,
      "firm_probability_bps": 9100,
      "price_improvement_atoms": 60,
      "planned_dark_exposure_quantity": 300,
      "reason": "expose-dark",
      "dark_cap_remaining_quantity": 1900
    }
  ],
  "state": "lit-fallback-required"
}

Other exports

This module also exports almgrenChrissOptimalExecution, implementationShortfallExecution, arrivalPriceExecution, liquiditySeekingExecution, 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

Opportunistic Dark-Pool Execution — system map

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.

Read the article →

References