fintech-algorithms

Maximum-Executable-Volume Auction

Install and import

bash
npm install fintech-algorithms
ts
import { maximumExecutableVolumeAuction } from "fintech-algorithms/matching-engines-and-venue-logic/auctions/maximum-executable-volume-auction";

Signature

maximumExecutableVolumeAuction(ordersRaw, referenceRaw, tickRaw)

Finds the price that crosses the most volume — the first and most important auction criterion. Ties are common, which is why the tie-break rules exist as their own topics. Prices and quantities are integer **atoms** — the venue's minimum increment — not floating-point currency. Matching arithmetic that rounds is matching arithmetic that disagrees with the exchange.

Parameters

NameTypeNotes
ordersRawOrder[]Auction orders with prices, quantities and sides.
referenceRawnumberReference price used when criteria tie.
tickRawnumberTick size in atoms.
min: 1 · integer: true

Returns

{ price, executable_volume, candidates, tie, … }

The clearing price and volume, with every tied candidate — a hidden tie is a hidden decision.

Errors

  • When 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

ordersRaw
[
  {
    "order_id": "B-101",
    "side": "buy",
    "order_type": "limit",
    "price": 101,
    "quantity": 300,
    "arrival_sequence": 10
  },
  {
    "order_id": "B-100",
    "side": "buy",
    "order_type": "limit",
    "price": 100,
    "quantity": 500,
    "arrival_sequence": 20
  },
  {
    "order_id": "S-099",
    "side": "sell",
    "order_type": "limit",
    "price": 99,
    "quantity": 200,
    "arrival_sequence": 30
  }
]

Showing 3 of 5 elements.

referenceRaw
100
tickRaw
1

Call

maximumExecutableVolumeAuction(ordersRaw, referenceRaw, tickRaw)

Returns

object with 9 fields: model, reference_price, tick_size, order_count, maximum_executable_quantity, maximum_volume_prices, unique_price, candidate_evaluations, …

{
  "model": "maximum-executable-volume-candidate-set",
  "reference_price": 100,
  "tick_size": 1,
  "order_count": 5,
  "maximum_executable_quantity": 600,
  "maximum_volume_prices": [100],
  "unique_price": 100,
  "candidate_evaluations": [
    {
      "price": 99,
      "buy_quantity": 800,
      "sell_quantity": 200,
      "executable_quantity": 200,
      "imbalance_quantity": 600,
      "absolute_imbalance": 600,
      "imbalance_side": "buy"
    },
    {
      "price": 100,
      "buy_quantity": 800,
      "sell_quantity": 600,
      "executable_quantity": 600,
      "imbalance_quantity": 200,
      "absolute_imbalance": 200,
      "imbalance_side": "buy"
    },
    {
      "price": 101,
      "buy_quantity": 300,
      "sell_quantity": 1100,
      "executable_quantity": 300,
      "imbalance_quantity": -800,
      "absolute_imbalance": 800,
      "imbalance_side": "sell"
    }
  ],
  "state": "unique-maximum"
}

Other exports

This module also exports minimumImbalanceTieBreak, openingCrossPrice, closingCrossPrice, 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

Maximum-Executable-Volume Auction — 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