Documentation
¶
Index ¶
- Constants
- Variables
- func AtmApprox(vol, timeToExpiry, spot, dividendYield float64, optionType OptionType) (price float64, err error)
- func CheckPriceParams(timeToExpiry, spot, strike float64, optionType OptionType) error
- func CorrectVolSign(extrinsic float64, vol float64) float64
- func Delta(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (delta float64, err error)
- func DeltaNumeric(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (delta float64, err error)
- func DeltaZeroSpot(t, q float64, o OptionType) float64
- func DeltaZeroStrike(t, q float64, o OptionType) float64
- func DeltaZeroVol(t, x, k, r, q float64, o OptionType) float64
- func Gamma(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (gamma float64, err error)
- func GammaNumeric(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (gamma float64, err error)
- func GammaZeroVol(t, x, k, r, q float64) float64
- func ImpliedVol(premium, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (vol float64, err error)
- func Intrinsic(timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) float64
- func NormCDF(x float64) float64
- func NormCDFInverse(q float64) float64
- func NormPDF(x float64) float64
- func Price(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (price float64, err error)
- func PriceSim(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (price float64, err error)
- func PriceZeroSpot(t, k, r float64, o OptionType) float64
- func PriceZeroStrike(t, x, q float64, o OptionType) float64
- func Theta(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (theta float64, err error)
- func ThetaNumeric(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (theta float64, err error)
- func ThetaZeroSpot(t, k, r float64, o OptionType) float64
- func ThetaZeroStrike(t, x, q float64, o OptionType) float64
- func ThetaZeroVol(t, x, k, r, q float64, o OptionType) float64
- func ValidOptionType(optionType OptionType) bool
- func Vega(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (vega float64, err error)
- func VegaNumeric(vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, ...) (vega float64, err error)
- type ImpliedVolParams
- type OptionType
Constants ¶
View Source
const ( Call = OptionType('c') Put = OptionType('p') Straddle = OptionType('s') )
Variables ¶
View Source
var ( ErrNegVol = errors.New("Negative volatility") ErrNegTimeToExp = errors.New("Negative time to expiry") ErrNegPremium = errors.New("Negative option premium") ErrNegPrice = errors.New("Negative underlying price") ErrNegStrike = errors.New("Negative strike") ErrUnknownOptionType = errors.New("Unknown option type") ErrNilPtrArg = errors.New("Nil pointer argument") ErrNoncovergence = errors.New("Did not converge") )
View Source
var ErrMaxIterations = errors.New("max iterations exceeded")
View Source
var ErrNegativeEpsilon = errors.New("epsilon must be positive")
Functions ¶
func AtmApprox ¶
func AtmApprox( vol, timeToExpiry, spot, dividendYield float64, optionType OptionType, ) (price float64, err error)
AtmApprox approximates the option price when the spot discounted by the dividend yield is equal to the strike discounted by the interest rate.
func CheckPriceParams ¶
func CheckPriceParams(timeToExpiry, spot, strike float64, optionType OptionType) error
CheckPriceParams checks whether timeToExpiry, spot, and strike are non-negative, and optionType is one of the defined OptionType constants
func CorrectVolSign ¶
func Delta ¶
func Delta( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, ) (delta float64, err error)
func DeltaNumeric ¶ added in v0.2.0
func DeltaNumeric( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, epsilon ...float64, ) (delta float64, err error)
func DeltaZeroSpot ¶ added in v0.2.0
func DeltaZeroSpot(t, q float64, o OptionType) float64
func DeltaZeroStrike ¶ added in v0.2.0
func DeltaZeroStrike(t, q float64, o OptionType) float64
func DeltaZeroVol ¶ added in v0.2.0
func DeltaZeroVol(t, x, k, r, q float64, o OptionType) float64
func Gamma ¶
func Gamma( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, ) (gamma float64, err error)
func GammaNumeric ¶ added in v0.2.0
func GammaNumeric( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, epsilon ...float64, ) (gamma float64, err error)
func GammaZeroVol ¶ added in v0.2.0
func ImpliedVol ¶
func ImpliedVol( premium, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, params ...ImpliedVolParams, ) (vol float64, err error)
func Intrinsic ¶
func Intrinsic( timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, ) float64
func NormCDFInverse ¶
func Price ¶
func Price( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, ) (price float64, err error)
func PriceSim ¶ added in v0.2.0
func PriceSim( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, numPaths ...uint, ) (price float64, err error)
func PriceZeroSpot ¶ added in v0.2.0
func PriceZeroSpot(t, k, r float64, o OptionType) float64
func PriceZeroStrike ¶ added in v0.2.0
func PriceZeroStrike(t, x, q float64, o OptionType) float64
func Theta ¶
func Theta( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, ) (theta float64, err error)
func ThetaNumeric ¶ added in v0.2.0
func ThetaNumeric( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, epsilon ...float64, ) (theta float64, err error)
func ThetaZeroSpot ¶ added in v0.2.0
func ThetaZeroSpot(t, k, r float64, o OptionType) float64
func ThetaZeroStrike ¶ added in v0.2.0
func ThetaZeroStrike(t, x, q float64, o OptionType) float64
func ThetaZeroVol ¶ added in v0.2.0
func ThetaZeroVol(t, x, k, r, q float64, o OptionType) float64
func ValidOptionType ¶
func ValidOptionType(optionType OptionType) bool
func Vega ¶
func Vega( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, ) (vega float64, err error)
func VegaNumeric ¶ added in v0.2.0
func VegaNumeric( vol, timeToExpiry, spot, strike, interestRate, dividendYield float64, optionType OptionType, epsilon ...float64, ) (vega float64, err error)
Types ¶
type ImpliedVolParams ¶
type OptionType ¶
type OptionType rune
Click to show internal directories.
Click to hide internal directories.