Overview
The Black-Scholes model computes the probability that a binary option finishes in-the-money, assuming the underlying price follows a geometric Brownian motion (GBM). For a binary call option with strike price K: where N is the standard normal cumulative distribution function and d₂ is defined below.Mathematical Formulation
The d₂ Parameter
Under the risk-neutral measure, the probability that the underlying price S exceeds the strike K at expiry T is: Where:- S = current underlying price
- K = strike price (threshold)
- σ = volatility (standard deviation of log returns, per-second)
- T = time remaining until expiry (seconds)
- r = continuous risk-free rate (per-second)
Time Units: All parameters must use consistent time units. This implementation uses seconds throughout. The volatility σ is expressed as per-second volatility, matching the output of the EWMA estimator.
Normal CDF Approximation
The implementation uses the Abramowitz and Stegun polynomial approximation for N(x): where: Coefficients:| Coefficient | Value |
|---|---|
| a₁ | 0.254829592 |
| a₂ | -0.284496736 |
| a₃ | 1.421413741 |
| a₄ | -1.453152027 |
| a₅ | 1.061405429 |
| p | 0.3275911 |
Maximum Error: 1.5 × 10⁻⁷ across the entire real line. This is more than sufficient for financial applications.
Implementation
Normal CDF Function
probability.js
Binary Call Probability
probability.js
Edge Cases
1. At or Past Expiry (T ≤ 0)
When time remaining is zero or negative, the outcome is deterministic:2. Degenerate Inputs
If volatility, current price, or strike price are zero or negative, the model returns 0.5 (neutral probability):Intuition
The d₂ Metric
d₂ measures how many standard deviations the current price is from the “break-even” log-return:- d₂ > 0: Current price is above the drift-adjusted strike → P > 0.5 (bullish)
- d₂ < 0: Current price is below the drift-adjusted strike → P < 0.5 (bearish)
- d₂ = 0: Exactly at the median outcome → P = 0.5
Effect of Parameters
| Parameter | Increases → | Probability Effect |
|---|---|---|
| Current Price (S) | Higher | Increases P(S_T > K) |
| Strike Price (K) | Higher | Decreases P(S_T > K) |
| Volatility (σ) | Higher | Moves P toward 0.5 (uncertainty) |
| Time (T) | Higher | Moves P toward 0.5 (more diffusion) |
| Risk-Free Rate (r) | Higher | Increases P(S_T > K) (drift) |
Volatility Dampening: High volatility broadens the probability distribution, pulling extreme probabilities (near 0 or 1) back toward 0.5. This reflects increased outcome uncertainty.
Usage Example
Integration with Engine
The prediction engine calls this function during the base probability calculation step:predictor.js
Assumptions and Limitations
Assumptions
- Geometric Brownian Motion: Price follows dS/S = r dt + σ dW
- Constant Volatility: σ does not change over [t, T]
- Log-Normal Returns: Log returns are normally distributed
- Frictionless Market: No transaction costs or constraints
- Continuous Trading: No gaps or jumps
Limitations
The engine mitigates these issues through:- EWMA Volatility: Adapts to changing volatility regimes
- Momentum Signals: Capture short-term trends not explained by GBM
- Platt Calibration: Corrects systematic probability biases
- Abstention Logic: Refuses to predict during anomalous regimes
Alternative Formulations
Why d₂ and not d₁?
The Black-Scholes model defines two parameters:- d₁: Used for delta (option sensitivity to price)
- d₂: Used for risk-neutral probability
Digital vs. Cash-or-Nothing
This implementation prices a cash-or-nothing call (pays 0): Since r = 0 (crypto markets) and we want probability (not price), the formula simplifies to N(d₂).References
- Black, F., & Scholes, M. (1973). “The Pricing of Options and Corporate Liabilities.” Journal of Political Economy, 81(3), 637-654.
- Abramowitz, M., & Stegun, I. A. (1964). Handbook of Mathematical Functions. National Bureau of Standards.
- Hull, J. C. (2017). Options, Futures, and Other Derivatives (10th ed.). Pearson.
Next Steps
Volatility Estimation
How the EWMA estimator produces per-second volatility
Prediction Engine
How Black-Scholes integrates with the full prediction pipeline