IVolatilityOracle
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
Name | Type | Description |
---|---|---|
params | int256[5] | Parameters of IV model to pack |
Returns
Name | Type | Description |
---|---|---|
result | bytes32 | The 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
Name | Type | Description |
---|---|---|
input | bytes32 | Packed IV model parameters to unpack |
Returns
Name | Type | Description |
---|---|---|
params | int256[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
Name | Type | Description |
---|---|---|
tokens | address[] | List of the base tokens |
tau | bytes32[] | List of maturities |
theta | bytes32[] | List of ATM total implied variance curves |
psi | bytes32[] | List of ATM skew curves |
rho | bytes32[] | List of rho curves |
riskFreeRate | UD60x18 | The risk-free rate |
getParams
Get the IV model parameters of a token pair
function getParams(address token) external view returns (VolatilityOracleStorage.Update memory);
Parameters
Name | Type | Description |
---|---|---|
token | address | The token address |
Returns
Name | Type | Description |
---|---|---|
<none> | VolatilityOracleStorage.Update | The IV model parameters |
getParamsUnpacked
Get unpacked IV model parameters
function getParamsUnpacked(address token) external view returns (VolatilityOracleStorage.Params memory);
Parameters
Name | Type | Description |
---|---|---|
token | address | The token address |
Returns
Name | Type | Description |
---|---|---|
<none> | VolatilityOracleStorage.Params | The 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
Name | Type | Description |
---|---|---|
token | address | The token address |
spot | UD60x18 | The spot price of the token |
strike | UD60x18 | The strike price of the option |
timeToMaturity | UD60x18 | The time until maturity (denominated in years) |
Returns
Name | Type | Description |
---|---|---|
<none> | UD60x18 | The 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
Name | Type | Description |
---|---|---|
token | address | The token address |
spot | UD60x18 | The spot price of the token |
strike | UD60x18[] | The strike price of the option |
timeToMaturity | UD60x18[] | The time until maturity (denominated in years) |
Returns
Name | Type | Description |
---|---|---|
<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
Name | Type | Description |
---|---|---|
<none> | UD60x18 | The 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();