FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::options Namespace Reference

Classes

struct  Greeks
 
struct  IvResult
 

Enumerations

enum class  CallPut : std::uint8_t { Call = 0 , Put = 1 }
 
enum class  IvStatus : std::uint8_t {
  Ok = 0 , AtIntrinsic = 1 , OutOfBounds = 2 , BadInput = 3 ,
  NoConvergence = 4
}
 

Functions

double norm_pdf (double x) noexcept
 Standard normal density and distribution. erfc keeps the far tail accurate (no 1 - N(x)).
 
double norm_cdf (double x) noexcept
 
constexpr double year_fraction (std::int64_t expiry_ns, std::int64_t now_ns) noexcept
 Year fraction between two epoch-ns timestamps (ACT/365); negative once expired.
 
Greeks black76 (CallPut cp, double forward, double strike, double t_years, double sigma, double rate=0.0) noexcept
 Price and greeks.
 
double black76_price (CallPut cp, double forward, double strike, double t_years, double sigma, double rate=0.0) noexcept
 
IvResult implied_vol (CallPut cp, double price, double forward, double strike, double t_years, double rate=0.0, double price_tol=1e-12, int max_iterations=100) noexcept
 Implied volatility of a Black-76 price.
 
double to_coin_price (double quote_value, double forward) noexcept
 Quote-currency value -> price in the base coin (Deribit BTC options: USD / underlying price).
 
constexpr double coin_delta (double delta, double coin_price) noexcept
 Delta of a coin-quoted option in coin units.
 

Variables

constexpr double kSecondsPerYear = 365.0 * 86400.0
 ACT/365, as Deribit's theta.
 
constexpr double kMinVol = 1e-4
 0.01 % annualised
 
constexpr double kMaxVol = 10.0
 1000 % annualised
 

Enumeration Type Documentation

◆ CallPut

enum class fastmm::options::CallPut : std::uint8_t
strong
Enumerator
Call 
Put 

◆ IvStatus

enum class fastmm::options::IvStatus : std::uint8_t
strong
Enumerator
Ok 
AtIntrinsic 

price at (or within tolerance of) the no-arbitrage lower bound: vol 0

OutOfBounds 

below intrinsic, or above what kMaxVol can produce

BadInput 

non-positive forward/strike/time or non-finite price

NoConvergence 

iteration bound hit; vol is the best bracket midpoint

Function Documentation

◆ norm_pdf()

double fastmm::options::norm_pdf ( double  x)
inlinenoexcept

Standard normal density and distribution. erfc keeps the far tail accurate (no 1 - N(x)).

< 1 / sqrt(2 pi)

◆ norm_cdf()

double fastmm::options::norm_cdf ( double  x)
inlinenoexcept

< 1 / sqrt(2)

◆ year_fraction()

constexpr double fastmm::options::year_fraction ( std::int64_t  expiry_ns,
std::int64_t  now_ns 
)
constexprnoexcept

Year fraction between two epoch-ns timestamps (ACT/365); negative once expired.

◆ black76()

Greeks fastmm::options::black76 ( CallPut  cp,
double  forward,
double  strike,
double  t_years,
double  sigma,
double  rate = 0.0 
)
inlinenoexcept

Price and greeks.

Degenerate inputs (T <= 0 or sigma <= 0) return the discounted intrinsic value with a step delta and zero gamma/vega/theta; F <= 0 or K <= 0 return all zeros.

◆ black76_price()

double fastmm::options::black76_price ( CallPut  cp,
double  forward,
double  strike,
double  t_years,
double  sigma,
double  rate = 0.0 
)
inlinenoexcept

◆ implied_vol()

IvResult fastmm::options::implied_vol ( CallPut  cp,
double  price,
double  forward,
double  strike,
double  t_years,
double  rate = 0.0,
double  price_tol = 1e-12,
int  max_iterations = 100 
)
inlinenoexcept

Implied volatility of a Black-76 price.

price_tol is the absolute price tolerance (same unit as price); iterations never exceed max_iterations.

Work undiscounted: the bounds are then [max(F-K, 0), F] for calls, [max(K-F, 0), K] for puts.

Brenner-Subrahmanyam start (exact at the money), kept inside the bracket.

Newton left the bracket (or produced NaN): bisect.

◆ to_coin_price()

double fastmm::options::to_coin_price ( double  quote_value,
double  forward 
)
inlinenoexcept

Quote-currency value -> price in the base coin (Deribit BTC options: USD / underlying price).

◆ coin_delta()

constexpr double fastmm::options::coin_delta ( double  delta,
double  coin_price 
)
constexprnoexcept

Delta of a coin-quoted option in coin units.

With V_coin = V / F, the coin value of the position changes by F * dV_coin/dF = dV/dF - V / F = delta - V_coin per unit move of F.

Variable Documentation

◆ kSecondsPerYear

constexpr double fastmm::options::kSecondsPerYear = 365.0 * 86400.0
inlineconstexpr

ACT/365, as Deribit's theta.

◆ kMinVol

constexpr double fastmm::options::kMinVol = 1e-4
inlineconstexpr

0.01 % annualised

◆ kMaxVol

constexpr double fastmm::options::kMaxVol = 10.0
inlineconstexpr

1000 % annualised