fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Corwin-Schultz Spread Estimator

Install and import#

bash
npm install fintech-algorithms
ts
import { corwinSchultzSpread } from "fintech-algorithms/market-microstructure/liquidity-and-spreads/corwin-schultz-spread-estimator";

Signature#

corwinSchultzSpread(highDay1, lowDay1, highDay2, lowDay2, clipNegative)

Estimates the spread from daily high-low ranges over two days, exploiting that the range reflects both volatility and spread while volatility scales with time and the spread does not. Frequently returns negative values, which are theoretically impossible.

Parameters#

NameTypeNotes
highDay1numberFirst day's high.
lowDay1numberFirst day's low.
highDay2numberSecond day's high.
lowDay2numberSecond day's low.
clipNegativebooleanWhether to clip negative estimates to zero. Corwin and Schultz recommend it; leaving them visible is more honest when averaging across a sample.

Returns#

{ spread, raw_spread, beta, gamma, alpha, clipped }

The estimate with every intermediate, and whether clipping was applied.

Errors#

  • When any high is below its low — 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#

highDay1
101
lowDay1
99
highDay2
101.5
lowDay2
99.5
clipNegative
true

Call#

corwinSchultzSpread(highDay1, lowDay1, highDay2, lowDay2, clipNegative)

Returns#

object with 9 fields: model, beta, gamma, alpha_raw, alpha_used, spread_estimate_relative, spread_estimate_bps, clip_negative, …

{
  "model": "corwin-schultz-spread",
  "beta": 0.0007960826118720654,
  "gamma": 0.0006219511446669105,
  "alpha_raw": 0.007908933752463966,
  "alpha_used": 0.007908933752463966,
  "spread_estimate_relative": 0.007908892526591878,
  "spread_estimate_bps": 79.08892526591879,
  "clip_negative": true,
  "state": "estimated"
}

Other exports#

This module also exports quotedSpread, effectiveSpread, realizedSpread, rollSpread, amihudIlliquidity, 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#

Corwin-Schultz Spread Estimator — calculation map
Corwin-Schultz Spread Estimator — decision boundary
Corwin-Schultz Spread Estimator — failure boundary
Corwin-Schultz Spread Estimator — scenario matrix
Corwin-Schultz Spread Estimator — system map

Calculation flow#

Corwin-Schultz Spread Estimator validation flow
flowchart LR
    A["Question: Can two consecutive daily high–low ranges separate spread from fundamental volatility?"] --> B["Freeze instrument, scope, clock, units, and variant"]
    B --> C["Validate Corwin-Schultz Spread Estimator inputs"]
    C --> D{"Eligible and synchronized?"}
    D -- "No" --> E["Reject with topic-specific reason"]
    D -- "Yes" --> F["Apply the frozen High–low spread formula"]
    F --> G["Expose intermediate value and decision state"]
    G --> H{"Direct measure or model-based proxy?"}
    H --> I["Report result with its unit and limitation"]

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#

  • Corwin and Schultz (2012), A Simple Way to Estimate Bid-Ask Spreads — The Journal of Finance
  • NYSE Daily TAQ product description — New York Stock Exchange

The rest of the Liquidity and Spreads family#