Quoted Spread
Install and import
npm install fintech-algorithmsimport { quotedSpread } from "fintech-algorithms/market-microstructure/liquidity-and-spreads/quoted-spread";Signature
quotedSpread(bid, ask)Ask minus bid — what the book advertises. The upper bound on what a small marketable order costs, and routinely wider than what trades actually pay.
Parameters
| Name | Type | Notes |
|---|---|---|
bid | number | Best bid price. |
ask | number | Best ask price; must not be below the bid. |
Returns
{ spread, relative_spread, midpoint, … }
The absolute spread with its relative form in basis points, which is the comparable one across instruments.
Errors
- When ask is below bid, or either is not positive — throws
Complexity: time O(1),
space O(1).
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
100100.08Call
quotedSpread(bid, ask)Returns
object with 8 fields: model, bid, ask, midpoint, quoted_spread, quoted_spread_relative, quoted_spread_bps, state
{
"model": "quoted-spread",
"bid": 100,
"ask": 100.08,
"midpoint": 100.03999999999999,
"quoted_spread": 0.0799999999999983,
"quoted_spread_relative": 0.0007996801279488034,
"quoted_spread_bps": 7.996801279488034,
"state": "two-sided"
}Other exports
This module also exports
effectiveSpread, realizedSpread, rollSpread, amihudIlliquidity, corwinSchultzSpread, 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
- SEC Rule 605 adopting release — U.S. Securities and Exchange Commission
- NYSE Daily TAQ product description — New York Stock Exchange
- 2024 Rule 605 Amendments adopting release — U.S. Securities and Exchange Commission
- Rule 605 staff frequently asked questions — U.S. Securities and Exchange Commission, Division of Trading and Markets staff
- Rule 605 staff FAQ transition — U.S. Securities and Exchange Commission, Division of Trading and Markets staff