Opportunistic Dark-Pool Execution
Install and import#
npm install fintech-algorithmsimport { 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#
| Name | Type | Notes |
|---|---|---|
input | DarkPoolInput | Quantity, 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#
{
"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#
Calculation flow#
Opportunistic Dark-Pool Execution calculation flow
flowchart LR
S1["Validate parent dark fraction thresholds lots fallback"]
S2["Compute the total lotfloored dark cap"]
S3["Before fallback accept only opportunities that pass pr"]
S4["Cap each exposure and send the unexposed residual to t"]
S1 --> S2
S2 --> S3
S3 --> S4
S4 --> D{"opportunity window exactly equal to the fallback window"}
D --> O["planned_dark_exposure_quantity + diagnostics"]
O --> A["Audit: Planned dark exposure never exceeds its cap"]
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#
- Regulation of NMS Stock Alternative Trading Systems — U.S. Securities and Exchange Commission
- Alternative Trading System (ATS) List — U.S. Securities and Exchange Commission
- OTC (ATS and Non-ATS) Transparency — Financial Industry Regulatory Authority
- 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