with_carry
module jetblack_options.numeric_greeks.with_carry
Summary
Class for calculating numeric greeks for options using finite difference
Description
methods for the generalised style using cost of carry.
class NumericGreeks
Parameters
price: Callable[[float, float, float, float, float, float], float]method NumericGreeks.carry
Summary
Calculate the carry on an option using the finite difference.
Description
The carry is calculated according to one of the three difference methods.
Central difference method.
Forward difference method.
Backward difference method.
Parameters
S: floatThe asset price.
The strike.
Time to expiry in years.
The risk free rate.
The cost of carry.
The volatility.
The absolute amount to change the carry rate by. Defaults to 0.001.
The method to use. Defaults to 'central'.
Returns
float: The numeric carry.method NumericGreeks.charm
Summary
Measures the instantaneous rate of change of delta over the passage of
Description
time.
Also known as DdeltaDtime.
Parameters
S: floatThe asset price.
The strike price.
The time to expiry in years.
The risk free rate.
The cost of carry.
The asset volatility.
Change in asset price. Defaults to 0.01.
Change in time. Defaults to 1/365.
Returns
float: The charm.method NumericGreeks.delta
Summary
Calculate the delta on an option using the finite difference.
Description
The delta is calculated according to one of the three difference methods.
Central difference method.
Forward difference method.
Backward difference method.
Parameters
S: floatThe asset price.
The strike.
Time to expiry in years.
The risk free rate.
The cost of carry.
The volatility.
The absolute amount to change the asset price by. Defaults to 0.01.
The method to use. Defaults to 'central'.
Returns
float: The numeric delta.method NumericGreeks.deltap
Parameters
S: floatReturns
float:method NumericGreeks.dgamma_dvol
Parameters
S: floatReturns
float:method NumericGreeks.elasticity
Parameters
S: floatReturns
float:method NumericGreeks.futures_rho
Parameters
S: floatReturns
float:method NumericGreeks.gamma
Summary
Calculate the gamma of an option using finite difference methods.
Description
The gamma is calculated according to one of the three difference methods.
Central difference method.
Forward difference method.
Backward difference method.
Parameters
S: floatThe asset price.
The strike.
Time to expiry in years.
The risk free rate.
The cost of carry.
The volatility.
The absolute amount to change the asset price by. Defaults to 0.01.
The method to use. Defaults to 'central'.
Returns
float: The numeric gamma.method NumericGreeks.gammap
Parameters
S: floatReturns
float:method NumericGreeks.rho
Summary
Calculate the rho on an option using the finite difference.
Description
The rho is calculated according to one of the three difference methods.
Central difference method.
Forward difference method.
Backward difference method.
Parameters
S: floatThe asset price.
The strike.
Time to expiry in years.
The risk free rate.
The cost of carry.
The volatility.
The absolute amount to change the rate by. Defaults to 0.001.
The method to use. Defaults to 'central'.
Returns
float: The numeric rho.method NumericGreeks.rho2
Parameters
S: floatReturns
float:method NumericGreeks.speed
Parameters
S: floatReturns
float:method NumericGreeks.strike_delta
Parameters
S: floatReturns
float:method NumericGreeks.strike_gamma
Parameters
S: floatReturns
float:method NumericGreeks.theta
Summary
Calculate the theta on an option using the finite difference.
Description
The theta is calculated according to one of the three difference methods.
Central difference method.
Forward difference method.
Backward difference method.
Parameters
S: floatThe asset price.
The strike.
Time to expiry in years.
The risk free rate.
The cost of carry.
The volatility.
The absolute amount to change the asset price by. Defaults to 1/365.
The method to use. Defaults to 'central'.
Returns
float: The numeric theta.method NumericGreeks.time_gamma
Parameters
S: floatReturns
float:method NumericGreeks.vanna
Summary
The second order derivative of the option price to a change in the asset
Description
price and a change in the volatility.
Parameters
S: floatThe asset price.
The strike price.
The time to expiry in years.
The risk free rate.
The cost of carry.
The asset volatility.
The change in spot price. Defaults to 0.01.
The change in volatility. Defaults to 0.01.
Returns
float: descriptionmethod NumericGreeks.vega
Summary
Calculate the vega on an option using the finite difference.
Description
The vega is calculated according to one of the three difference methods.
Central difference method.
Forward difference method.
Backward difference method.
Parameters
S: floatThe asset price.
The strike.
Time to expiry in years.
The risk free rate.
The cost of carry.
The volatility.
The method to use. Defaults to 'central'.
Returns
float: The numeric vega.method NumericGreeks.vegap
Parameters
S: floatReturns
float:method NumericGreeks.vomma
Summary
Calculate the vomma of an option using finite difference methods.
Description
The vomma is calculated according to one of the three difference methods.
Central difference method.
Forward difference method.
Backward difference method.
Parameters
S: floatThe asset price.
The strike.
Time to expiry in years.
The risk free rate.
The cost of carry.
The volatility.
The absolute amount to change the volatility price by. Defaults to 0.001.