How to Price Exotic Options in R - YouTube

Channel: Luxmon TRCNR

[0]
Hi, everyone! . In this video, we are going through the option pricing by using R program
[6]
How to price options?
[8]
Well, options are priced depending on 6 parameters, as follow..
[13]
The current price of the underlying asset; S
[17]
The strike price; K
[19]
The underlying asset’s volatility; sigma
[22]
The risk-free rate; r
[24]
The dividend rate; q
[27]
the formula here, there is already subtract with the risk-free rate, so it show only “r” here
[34]
And the time-to-maturity with units in years; T
[39]
The function N() that appears in the formula, denotes the cumulative function of the standard normal distribution.
[47]
However, there are assumptions behind the model.
[50]
Obviously, these assumptions do not meet in reality,
[54]
but the black-scholes model offers you the best way to price options for now.
[58]
Now, let’s price an option by using this Black Scholes model in R
[64]
Before we start, just so you know,
[66]
we’ll be focusing on the option pricing functions only.
[70]
For other purposes, you can take a look online.
[74]
First, we open R studio program, there are actually 4 main parts
[81]
Top Left is for writing commands
[84]
Bottom left is result of submitting the codes that you wrote
[89]
Top right shows the environment and Bottom right shows plots
[95]
You can type your code as a function here
[99]
I will give you an example of the general option price model that we’re all familiar with
[104]
-- BlackSholesMerton, which the model is the closed form formula to price an option.
[112]
Let’s say I would like to compute a call option price
[116]
given 6 variables spot price s, strike price k,
[122]
annual risk free rate r, volatility sigma, dividend yield delta,
[131]
time at maturity double capital t, time at evaluation double small t
[138]
First we need to state 6 inputs in a function of BSMCall,
[144]
then, open the blanket to input d1 and d2 formulas
[153]
After we state that d1 and d2 are normal distributed function,
[158]
then state call option pricing formula, I named it as “callvalue”
[164]
CallVal = S*exp(-delta*(TT-tt))*pnorm(d1)-K*exp(-r*(TT-tt))*pnorm(d2) which is the formula above, close the blanket.
[204]
After we finish filling formula, we then compute by giving 6 inputs
[210]
Call1=BSMCall(spot = 96, strike price = 90, annual risk free rate = 0.1,
[224]
sigma = 0.25, delta = 0, Double capital t=1, double small t = 0.25
[234]
Lets run it!
[238]
There is an error. It says “unexpected close blanket” here,
[244]
so we can go back, check and delete our error.
[250]
Okay! after we fix the mistake, run it again.
[254]
The result is the call price based on input 6 variables is 15.5
[260]
As you may know, there are different variety of options out there in the market.
[265]
Depending on benefits and cost of risk,
[269]
we can generally categorize into standard option and exotic option
[272]
Let's share 3 types of exotic options
[275]
to get you familiar for your future studies:
[279]
Asian Option, Binary Option and Lookback Option.
[284]
Ok! Let’s get started with Asian Option.
[288]
The reason I pick Asian Option first is because
[291]
his is a basic form of exotic options.
[295]
Its payoff is pretty much similar to standard options.
[299]
The difference is that payout is determined by the average value of underlying asset over predetermined period.
[307]
whereas, payoff of standard options depends on price of underlying at specific point in time.
[313]
Therefore, it is also known as “average value option”.
[318]
Basically, these options allow you to buy or sell the underlying at the average price instead of spot price.
[327]
After we have done manually priced a call option using Black Scholes model,
[333]
I prepare the package of codes that contain 3 main pricing commands for each exotic option.
[340]
But first, you need to download the file “FExoticOption”,
[345]
then we need to install the file from our library using this command.
[351]
After we install the file, Asian option’s formula in R is called GeometricAverageRateOption.
[359]
If you have no idea what GeometricAverageRateOption is, you can simply fill “?” sign in the front.
[367]
Then, you highlight and run the code.
[370]
The bottom right pop up information of GeometricAverageRateOption for you. Easy-peasy right?
[377]
Are you following us? I hope yes. Now! let’s tell R the value of your 6 variables!!
[384]
I apply the previous example from the Black Scholes model which
[388]
spot price is 96, strike price 90. Time is computed from 1-0.25 which is 0.75, r = 0.1, delta b = 0.1, sigma = 0.25
[403]
Noted that type flag C means that I would like to price call option.
[408]
Are you ready? check your codes, then run! Here you go!
[414]
Price1 is the CALL option price. You can click it for more detail to see input parameters and the value of this call option which is 9.96.
[427]
But if you want the price to immediately pop up on the screen, you just add one more command at the back which is @price
[436]
Then why we use this option? Due to its features,
[442]
its volatility is less than the volatility of the spot price which make asian options are less expensive than standard counterparts.
[451]
It can also reduce the market manipulation which is another main benefit.
[457]
On the other side, Asian option will not provide the opportunity to make large profit at peek moments which is created by high volatility.
[469]
Wake up!!!!!!!!!! We are moving onto the second exotic option: Binary Option
[474]
As you may aware of the name “binary”, this option simply depends on either of the two outcomes
[481]
which is a “yes or no” proposition.
[484]
You will get the payout if option expires “in the money” and incur a loss if it expires “out of the money”.
[492]
The main features of binary option are a fixed maximum payout and it limits the risk only for the amount that you invested.
[501]
So, you don’t have to bother with the price movement of underlying.
[505]
No matter which types of binary option you trade,
[509]
the risk is the “position size” on a single trade.
[513]
Binary option pricing for R is pretty much similar to Asian option in terms of input variables.
[519]
I brought you 2 examples, one is “Asset-Or-Nothing-Option”, and another is “Cash-Or-Nothing-Option”.
[525]
Inputs of “Asset-Or-Nothing-Option” are similar to Asian and European options,
[532]
So, here is the example for you, TypeFlag = "p" for put,
[538]
S = 70, strike price X = 65, Time = 0.5, r = 0.07, b = 0.02, sigma = 0.27.
[552]
But for “Cash-Or-Nothing-Option”, one additional variable is required which K is the cash at the expiration
[561]
if the binary option is “in the money”. The command is
[564]
“CashOrNothingOption” (TypeFlag = "p", S = 100, X = 80, K = 10, Time = 9/12, r = 0.06, b = 0, sigma = 0.35)@price
[588]
There you go the prices of both binary options are shown, and I will leave binary-barrier options for you to try!
[596]
Here we come to the last exotic option for this video, the Lookback options.
[602]
Again, for more details you can search online.
[605]
To price the lookback option,
[607]
we calculate the option's price at or near the widest expected distance of price differential,
[614]
based on past volatility, and demand for the options. There are 2 broadly types of Lookback options...
[622]
Firstly, the floating strike lookback option,
[625]
we calculate the payoff by comparing the closing price and the most favorable strike price.
[631]
So, the input variables of floating strike lookback option are similar to Asian option.
[637]
The lowest price is observed from the underlying in the case of the call
[643]
or the highest price in the case of the put (SMinOrMax), instead of strike price.
[651]
You can simply compute the price in R. For example, you want to price a call option with the current asset price at 120 dollars.
[660]
The asset used to have the lowest price at 100 dollars.
[664]
The contract will be expired in 6 months. The risk-free rate is 1%. 5% is cost of carrying, and 30% for volatility.
[676]
Then bang! The price of this options would be 27 dollar as shown here.
[685]
Secondly, fixed strike lookback option, we fixed the strike price as always,
[691]
but the holders can pick the best underlying asset price to compute the payoff.
[695]
Pricing this option is the same as the floating strike lookback option,
[699]
but we need one more factor, which is “the fixed strike price”.
[703]
Let’s assume that the fixed strike price is 110 dollars.
[707]
We type the formula, add the same variables as previous and add the strike price here

[713]
Then, we run the result.
[715]
So, the price for fixed strike lookback option would be around 35 dollars.
[721]
Here we come to the end, we do appreciate to make this VDO and thank you everyone for watching.
[729]
You can find our coding package under this VDO. Thank you so much