Closing-Cross Price
Install and import
npm install fintech-algorithmsimport { closingCrossPrice } from "fintech-algorithms/matching-engines-and-venue-logic/auctions/closing-cross-price";Signature
closingCrossPrice(orders, reference, tick, low, high)The closing auction, which sets the price index funds actually trade at. Same criteria as the open, different reference and typically a tighter permitted band.
Parameters
| Name | Type | Notes |
|---|---|---|
orders | Order[] | Orders entered into the closing auction. |
reference | number | Reference price for tie-breaking. |
tick | number | Tick size in atoms. min: 1 · integer: true |
low | number | Lower bound of the permitted range. |
high | number | Upper bound. |
Returns
{ price, volume, imbalance, criterion_applied, … }
The closing price with the deciding criterion.
Errors
- When low exceeds high, or no order crosses — reported as a status rather than thrown
Complexity: time O(orders log orders),
space O(prices).
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
[
{
"order_id": "MOC-B",
"side": "buy",
"order_type": "MOC",
"price": null,
"quantity": 300,
"arrival_sequence": 10
},
{
"order_id": "LOC-B101",
"side": "buy",
"order_type": "LOC",
"price": 101,
"quantity": 350,
"arrival_sequence": 20
},
{
"order_id": "DAY-B100",
"side": "buy",
"order_type": "DAY",
"price": 100,
"quantity": 250,
"arrival_sequence": 30
}
]Showing 3 of 7 elements.
100195105Call
closingCrossPrice(orders, reference, tick, low, high)Returns
object with 15 fields: model, session, reference_price, collar_low, collar_high, eligible_order_count, selected_price, executed_quantity, …
{
"model": "declared-closing-cross",
"session": "closing",
"reference_price": 100,
"collar_low": 95,
"collar_high": 105,
"eligible_order_count": 7,
"selected_price": 100,
"executed_quantity": 700,
"buy_quantity": 900,
"sell_quantity": 700,
"imbalance_quantity": 200,
"imbalance_side": "buy",
"selection_trace": [
"maximize executable quantity at 700",
"minimize absolute imbalance at 200",
"the objective hierarchy leaves one price"
],
"candidate_evaluations": [
{
"price": 99,
"buy_quantity": 900,
"sell_quantity": 400,
"executable_quantity": 400,
"imbalance_quantity": 500,
"absolute_imbalance": 500,
"imbalance_side": "buy"
},
{
"price": 100,
"buy_quantity": 900,
"sell_quantity": 700,
"executable_quantity": 700,
"imbalance_quantity": 200,
"absolute_imbalance": 200,
"imbalance_side": "buy"
},
{
"price": 101,
"buy_quantity": 650,
"sell_quantity": 1150,
"executable_quantity": 650,
"imbalance_quantity": -500,
"absolute_imbalance": 500,
"imbalance_side": "sell"
}
]
}Showing 14 of 15 fields.
Other exports
This module also exports
maximumExecutableVolumeAuction, minimumImbalanceTieBreak, openingCrossPrice, volatilityAuctionReopening, 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
- Nasdaq Equity 4 Trading Rules — The Nasdaq Stock Market LLC
- The Nasdaq Opening and Closing Crosses — Nasdaq Trader
- The Nasdaq Stock Market System Settings — Nasdaq Trader
- T7 Release 14.0 Functional Reference, Version 3 — Deutsche Börse Group
- Introduction of T7 Release 14.1 — Deutsche Börse Cash Market
- Evidence boundary