Quickstart
Put your quotes in arrays, one array per field, and call ov_iv_solve. Every array has length n.
#include "optionvalley.h"
double sigma[N], greeks[6 * N];
ov_iv_solve(N, price, fwd, strike, years, is_call,
sigma, greeks, OV_WIDEST, 0);
Link with -loptionvalley. The library selects the best code path for the processor; every path returns identical results.
Inputs
| Field | Meaning |
|---|---|
price | Option price on the forward: the market price divided by the discount factor to expiry. |
fwd | Forward of the underlying to expiry. You choose the rates and dividends behind it. |
strike | Strike, in the same units as the forward. |
years | Time to expiry in years, from one minute up. |
is_call | 1 for a call, 0 for a put. |
Taking the price on the forward keeps discounting and dividends in your hands: the engine does not guess a curve.
Outputs
sigma receives the Black implied volatility per quote. If greeks is not NULL it receives the requested Greeks, laid out as one block of n per Greek; the evaluation pack documents the full set to third order.
Greeks
Greeks are those of the undiscounted Black price at the solved volatility; multiply by the discount factor for discounted Greeks. Every Greek to third order is available, including mixed terms, validated against a high-precision reference.
Certificates
ov_iv_certify returns, per quote, the smallest relative half-width w for which the exact implied volatility of your inputs provably lies in [sigma (1 - w), sigma (1 + w)]. A width of 0 means no bracket was found, for example when the time value is below 1e-290.
Same results everywhere
Option Valley returns identical results on every supported CPU and GPU, at every thread count. A build identifier recorded next to an output hash lets any team reproduce a run exactly.
Threads
The last argument sets the number of threads; 0 uses all of them. Books of any size are distributed evenly.
GPU
The NVIDIA GPU build returns the same results as the CPU build. Keep the book resident on the device for the best throughput, or divide a book between CPU and GPU.
Functions
| Function | Does |
|---|---|
ov_iv_solve | Implied volatility and, optionally, six Greeks for a book. |
ov_iv_certify | A proven bracket around each solved volatility. |
ov_american_iv | American implied volatility and Greeks, with early exercise and discrete dividends. |
ov_surface_fit | Fit a volatility surface across expiries and recalculate a book from it. |
ov_build_info | Build identifier and version, to record next to an output hash. |
Edge cases
A quote with zero time value returns a volatility of 0. A price outside the no-arbitrage bounds returns NaN. Neither stops the rest of the book.