Class TouchOption
With log-drift m = r − q − σ²/2 and barrier log-distance
h = ln(H/S), the reflection principle gives the probability of
touching an upper barrier (h > 0) by expiry:
P = N((−h + mT)/σ√T) + e^{2mh/σ²} · N((−h − mT)/σ√T)
and symmetrically for a lower barrier. A one-touch paying at expiry is
payout·e^{−rT}·P; a no-touch is the complement. Conventions match
BlackScholes: carry is the continuous yield (foreign rate
for FX).
Pay-at-hit one-touches (rebate paid immediately on touch) discount to
the hitting time instead: oneTouchPayAtHit(double, double, double, double, double, double, double). Double no-touch and
double one-touch (two barriers, pay at expiry) are
doubleNoTouch(double, double, double, double, double, double, double, double) and doubleOneTouch(double, double, double, double, double, double, double, double).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNumber of image terms on each side used bydoubleNoTouchProbability(double, double, double, double, double, double, double): the series runs overn = -N..N. -
Method Summary
Modifier and TypeMethodDescriptionstatic doubledoubleNoTouch(double spot, double lower, double upper, double rate, double carry, double vol, double timeYears, double payout) Double no-touch: payspayoutat expiry if spot never toucheslowerorupper.static doubledoubleNoTouchProbability(double spot, double lower, double upper, double rate, double carry, double vol, double timeYears) Probability that spot stays strictly inside(lower, upper)untiltimeYearsunder GBM with continuous monitoring.static doubledoubleOneTouch(double spot, double lower, double upper, double rate, double carry, double vol, double timeYears, double payout) Double one-touch paying at expiry: payspayoutif either barrier is touched before expiry.static doublehitProbability(double spot, double barrier, double rate, double carry, double vol, double timeYears) Probability that spot touchesbarrierat least once beforetimeYears, under GBM with the given rate/carry/vol.static doublenoTouch(double spot, double barrier, double rate, double carry, double vol, double timeYears, double payout) Payspayoutat expiry if the barrier never traded.static doubleoneTouch(double spot, double barrier, double rate, double carry, double vol, double timeYears, double payout) Payspayoutat expiry if the barrier traded at any point.static doubleoneTouchPayAtHit(double spot, double barrier, double rate, double carry, double vol, double timeYears, double payout) One-touch payingpayoutat the moment the barrier is first touched (American digital, "rebate at hit").
-
Field Details
-
DOUBLE_TOUCH_SERIES_TERMS
public static final int DOUBLE_TOUCH_SERIES_TERMSNumber of image terms on each side used bydoubleNoTouchProbability(double, double, double, double, double, double, double): the series runs overn = -N..N. Term n is bounded byexp(-2 n^2 l^2 / (vol^2 T))times a factor of orderexp(2 |mu| n l), withl = ln(U/L); forl / (vol sqrt T) >= 0.1the omitted tail is below 1e-15 of the payout (checked against the eigenfunction series in the tests).- See Also:
-
-
Method Details
-
hitProbability
public static double hitProbability(double spot, double barrier, double rate, double carry, double vol, double timeYears) Probability that spot touchesbarrierat least once beforetimeYears, under GBM with the given rate/carry/vol. -
oneTouch
public static double oneTouch(double spot, double barrier, double rate, double carry, double vol, double timeYears, double payout) Payspayoutat expiry if the barrier traded at any point. -
noTouch
public static double noTouch(double spot, double barrier, double rate, double carry, double vol, double timeYears, double payout) Payspayoutat expiry if the barrier never traded. -
oneTouchPayAtHit
public static double oneTouchPayAtHit(double spot, double barrier, double rate, double carry, double vol, double timeYears, double payout) One-touch payingpayoutat the moment the barrier is first touched (American digital, "rebate at hit"). Closed form of Reiner and Rubinstein (1991, "Breaking down the barriers", Risk 4(8)), as printed in Haug (2007, The Complete Guide to Option Pricing Formulas, 2nd ed., section 4.17.3, rebate term F). Withb = rate - carry,mu = (b - vol^2/2) / vol^2 lambda = sqrt(mu^2 + 2 rate / vol^2) z = ln(H/S) / (vol sqrt T) + lambda vol sqrt T price = payout [ (H/S)^(mu+lambda) N(eta z) + (H/S)^(mu-lambda) N(eta z - 2 eta lambda vol sqrt T) ]
with
eta = +1for a lower barrier (H < S) andeta = -1for an upper one. The formula is the Laplace transformE[e^{-rate tau} 1{tau <= T}]of the first-passage time tau, soratediscounts from the hitting time, not from expiry. For FX,rateis the domestic rate andcarrythe foreign rate, and the payout is in domestic currency. Withrate = 0it equalsoneTouch(double, double, double, double, double, double, double)(tested). Requiresmu^2 + 2 rate / vol^2 >= 0; a more negative domestic rate has no real lambda and is rejected.- Parameters:
barrier- the touch level; above spot is an up-touch, below a down-touch- Returns:
- present value in the payout currency;
payoutif spot is at the barrier
-
doubleNoTouchProbability
public static double doubleNoTouchProbability(double spot, double lower, double upper, double rate, double carry, double vol, double timeYears) Probability that spot stays strictly inside(lower, upper)untiltimeYearsunder GBM with continuous monitoring. Image-sum series of Ikeda and Kunitomo (1992, "Pricing options with curved boundaries", Mathematical Finance 2(4)) with flat boundaries, written in log space withx = ln(S/L),l = ln(U/L),m = rate - carry - vol^2/2,a = m / vol^2,s = vol sqrt T:P = sum_{n=-N..N} e^{-2 a n l} [N((l - x + 2nl - mT)/s) - N((2nl - x - mT)/s)] - e^{-2 a (x + n l)} [N((l + x + 2nl - mT)/s) - N((x + 2nl - mT)/s)]with
N =DOUBLE_TOUCH_SERIES_TERMS. Returns 0 when spot is on or outside a barrier. -
doubleNoTouch
public static double doubleNoTouch(double spot, double lower, double upper, double rate, double carry, double vol, double timeYears, double payout) Double no-touch: payspayoutat expiry if spot never toucheslowerorupper. Equalspayout e^{-rate T} doubleNoTouchProbability(...);rateis the domestic rate andcarrythe foreign rate for FX. -
doubleOneTouch
public static double doubleOneTouch(double spot, double lower, double upper, double rate, double carry, double vol, double timeYears, double payout) Double one-touch paying at expiry: payspayoutif either barrier is touched before expiry. The complement ofdoubleNoTouch(double, double, double, double, double, double, double, double).
-