# Internal Design of Digital Option Pricing Engines¶

## Overview¶

Digital Option pricing engine uses Monte Carlo Simulation to estimate the value of digital option. Here, we assume the process of asset pricing applies to Black-Scholes process.

Digital option is an option whose payoff is characterized as having only two potential values: a fixed payout, when the option is in the money or a zero payout otherwise. It is not related to how far the asset price at maturity is above (call) or below (put) the strike.

Digital options are attractive to buyers because the option payoff is a known constant amount, and this amount can be adjusted to provide the exact quantity of protection required. It overcomes a fundamental problem with the vanilla options, where the potential loss is unlimited, referring to the wiki.

Note

Only one type of digital options is supported:

- Cash-or-nothing option: Pays some fixed amount of cash if the option expires in the money.
- Asset-or-nothing option (not supported)

## Implementation¶

The implementation of digital option pricing engine is very similar to the barrier option pricing engine. It also uses the Brownian Bridge to correct the hitting error. Here, the exercise of digital option could be at the expiry time or any time between the expiry time and the 0 time, which is configured the by exEarly input arguments. When argument exEarly is false, the fixed cash is paid at the expiry time and it is discounted to time zero for the value of option. Otherwise, once the maximum or the minimum of the asset price hits the strike value, the fixed cash is paid and it is discounted to time 0 for the value of option.

In the following, we will take put digital option as an example to elaborate. Let \(T\) be the maturity time of option. The maturity time \(T\) is discretized by time steps \(N\). The strike value is \(K\). \(C\) is the fixed cash which paid when option is in the money.

The detailed procedure of Monte Carlo Simulation is as follows:

- For \(i\) = 1 to \(M\)

- For \(j\) = 1 to \(N\)

- generate a normal random number and uniform random number \(u\);
- simulate the price of asset \(S^i_j\);
- simulate the maximum price of asset \(M\) during time interval \([t_{j-1}, t_j]\).

- Calculate the payoff and discount it to time 0 for option price \(P_i\). if \(M > K\),

or if \(M\) for all time interval never cross strike,

So, the estimated value of option is the average of all the samples.