IVolatilityOracle

Git Source

Functions

formatParams

Pack IV model parameters into a single bytes32

This function is used to pack the parameters into a single variable, which is then used as input in update

function formatParams(int256[5] calldata params) external pure returns (bytes32 result);

Parameters

NameTypeDescription
paramsint256[5]Parameters of IV model to pack

Returns

NameTypeDescription
resultbytes32The packed parameters of IV model

parseParams

Unpack IV model parameters from a bytes32

function parseParams(bytes32 input) external pure returns (int256[5] memory params);

Parameters

NameTypeDescription
inputbytes32Packed IV model parameters to unpack

Returns

NameTypeDescription
paramsint256[5]The unpacked parameters of the IV model

updateParams

Update a list of Anchored eSSVI model parameters

function updateParams(
    address[] calldata tokens,
    bytes32[] calldata tau,
    bytes32[] calldata theta,
    bytes32[] calldata psi,
    bytes32[] calldata rho,
    UD60x18 riskFreeRate
) external;

Parameters

NameTypeDescription
tokensaddress[]List of the base tokens
taubytes32[]List of maturities
thetabytes32[]List of ATM total implied variance curves
psibytes32[]List of ATM skew curves
rhobytes32[]List of rho curves
riskFreeRateUD60x18The risk-free rate

getParams

Get the IV model parameters of a token pair

function getParams(address token) external view returns (VolatilityOracleStorage.Update memory);

Parameters

NameTypeDescription
tokenaddressThe token address

Returns

NameTypeDescription
<none>VolatilityOracleStorage.UpdateThe IV model parameters

getParamsUnpacked

Get unpacked IV model parameters

function getParamsUnpacked(address token) external view returns (VolatilityOracleStorage.Params memory);

Parameters

NameTypeDescription
tokenaddressThe token address

Returns

NameTypeDescription
<none>VolatilityOracleStorage.ParamsThe unpacked IV model parameters

getVolatility

Calculate the annualized volatility for given set of parameters

function getVolatility(address token, UD60x18 spot, UD60x18 strike, UD60x18 timeToMaturity)
    external
    view
    returns (UD60x18);

Parameters

NameTypeDescription
tokenaddressThe token address
spotUD60x18The spot price of the token
strikeUD60x18The strike price of the option
timeToMaturityUD60x18The time until maturity (denominated in years)

Returns

NameTypeDescription
<none>UD60x18The annualized implied volatility, where 1 is defined as 100%

getVolatility

Calculate the annualized volatility for given set of parameters

function getVolatility(address token, UD60x18 spot, UD60x18[] memory strike, UD60x18[] memory timeToMaturity)
    external
    view
    returns (UD60x18[] memory);

Parameters

NameTypeDescription
tokenaddressThe token address
spotUD60x18The spot price of the token
strikeUD60x18[]The strike price of the option
timeToMaturityUD60x18[]The time until maturity (denominated in years)

Returns

NameTypeDescription
<none>UD60x18[]The annualized implied volatility, where 1 is defined as 100%

getRiskFreeRate

Returns the current risk-free rate

function getRiskFreeRate() external view returns (UD60x18);

Returns

NameTypeDescription
<none>UD60x18The current risk-free rate

Events

UpdateParameters

event UpdateParameters(address indexed token, bytes32 tau, bytes32 theta, bytes32 psi, bytes32 rho);

Errors

VolatilityOracle__ArrayLengthMismatch

error VolatilityOracle__ArrayLengthMismatch();

VolatilityOracle__OutOfBounds

error VolatilityOracle__OutOfBounds(int256 value);

VolatilityOracle__SpotIsZero

error VolatilityOracle__SpotIsZero();

VolatilityOracle__StrikeIsZero

error VolatilityOracle__StrikeIsZero();

VolatilityOracle__TimeToMaturityIsZero

error VolatilityOracle__TimeToMaturityIsZero();