NAME
Quant::Framework::VolSurface
DESCRIPTION
Base class for all volatility surfaces.
for_date
The date for which we want to have the volatility surface data
ATTRIBUTES
symbol
The symbol of the underlying that this surface is for (e.g. frxUSDJPY)
recorded_date
The date (and time) that the surface was recorded, as a Date::Utility.
type
Type of the surface, delta, moneyness or flat.
surface
Stores the represented surface as a data structure (read-only).
Term structures of CALL delta or moneyness to annualized volatilities.
default_vol_spread
This will return default volatility spread (difference between ask and bid for atm volatility).
smile_points
The points across a smile.
It can be delta points, moneyness points or any other points that we might have in the future.
spread_points
This will give an array-reference containing volatility spreads for first tenor which has a volatility spread (or ATM if none).
print_precision
The precision at which we should output vols, in number of digits after the decimal. If set 0 or undefined, we will use full precision
term_by_day
Get all the terms in a surface in ascending order.
original_term
The terms we were originally supplied for this surface.
original_term_for_smile
The original term structure we have for smiles on a surface
original_term_for_spread
The original term structure we have for spreads on a surface
effective_date
Surfaces roll over at 5pm NY time, so the vols of any surfaces recorded after 5pm NY but before GMT midnight are effectively for the next GMT day. This attribute holds this effective date.
get_spread
Spread is ask-bid difference which can be stored for different tenor and atm/max.
USAGE:
my $spread = $volsurface->get_spread({sought_point=> 'atm', day=> 7});
will return the atm spread for the day.
my $spread = $volsurface->get_spread({sought_point=> 'max', day=> 7});
will return the max spread for the day.
get_smile_spread
Returns the ask/bid spread for smile of this volatility surface
set_smile_spread
sets smile spread for the given tenor. Input should be a hash-ref with below items: - days: Tenor for which smile_spread needs to be set. - smile_spread
get_day_for_tenor
USAGE:
my $day = $volsurface->get_day_for_tenor('1W');
Get the corresponding day for a given tenor, if one exists.
METHODS
get_volatility
USAGE:
my $vol = $vol_surface->get_volatility({
days => 7,
delta => 50,
});
Interpolates (on the two-dimensional vol surface) using Bloomberg's method.
get_smile
Get the smile for specific day.
Usage:
my $smile = $vol_surface->get_smile($days);
set_smile
Set a smile into the volatility surface Input: day and smile (key: smile_point ; value: volatility)
Usage:
$vol_surface->set_smile($day, \%smile);
get_rr_bf_for_smile
Return the rr and bf values for a given smile For more info see: https://en.wikipedia.org/wiki/Risk_reversal and https://en.wikipedia.org/wiki/Butterfly_(options)
get_market_rr_bf
Returns the rr and bf values for a given day
set_smile_flag
Sets a flag to a smile.
It is an ArrayRef of smile flag messages. If a flag is set we will not allow clients to buy new contracts.
Usage:
$vol_surface->set_smile_flag($time_days, $flag)
get_smile_flag
Get the flag (as an array-ref) for a specific smile.
A flag means there is an error/irregularity of the smile/quote too old/ etc.
Usage:
my $smile_flag = $vol_surface->get_smile_flag($day)
get_smile_flags
Get all flags of the surface. Takes no args. Return value is a string in the format "day1:flag1;day2:flag2;day3:flag3..."
fetch_historical_surface_date
Get historical vol surface dates going back a given number of historical revisions.
is_valid
Validates this volatility surface and returns possible errors (or empty if surface is valid).
get_existing_surface
Returns original surface and not the cut surface