## 亞式選擇權訂價實作：American-style Asian Single-barrier Up-and-out Calls Pricing based on the CRR binomial tree

### 一、問題描述：American-style Asian single-barrier up-and-out calls Pricing

Write a program to price American-style Asian single-barrier up-and-out calls based on the CRR binomial tree.

The payoff of this call at expiration date is max(average - X, 0) if the running average never touches or penetrates the barrier and 0 if otherwise.

Note also that the call may be exercised at any time before the expiration date due to its American-style characteristic.

Inputs:

• S (stock price at time 0),
• X (strike price),
• H (barrier, which is higher than S),
• t (maturity in years),
• s (%) (annual volatility),
• r (%) (continuously compounded annual interest rate),
• n (number of periods), and
• k (number of states per node).

For example, when

S = 100, X = 80, H = 130, t = 1 (years), s = 30%, r = 10%, n = 100, and k = 300,

### 二、執行方式

https://github.com/dragonkiss81/AsianOptionPricing

g++ asian_pricing.cpp -o asian_pricing.o


./asian_pricing.o


test.txt

100
80
130
1
0.3
0.1
100
300


### 三、設計與實作

#### 1. Binomial Tree 與 Black-Scholes Model

• Black-Scholes formula needs 5 parameters : S, X, σ, τ, and r.
• Binomial tree algorithms take 6 inputs : S, X, u, d, rˆ, and n.

The connections are :

and pseudo probability is :

#### 2. Create Running Average Tree with Interpolation

Amax :

Amin :

double ***asianMTree = Create3DArray(node_num, node_num, k+1);

for(int j=0; j<node_num; j++){
for(int i=0; i<=j; i++){
for(int m=0; m<=k; m++){
asianMTree[j][i][m] = InterpoStates(j, i, m);
}
}
}


#### 3. Pure Asian Call Pricing

a. 求Au (Running Average)

[感覺] 加權平均：像是全班30人平均身高是160 加一個身高170的人 全班身高平均變多少的感覺

b. 求足碼 l

[小心] 對於 l 的例外處理

if(Au > AvgMax(j+1,i) || (AvgMax(j+1,i)-Au)< 0.0001 ){
Cu = CTree[j+1][i][k];
}
else if(Au < AvgMin(j+1,i)){
Cu = CTree[j+1][i][0];
}
else{
//Interpolation
}


c. 求對應的內插比例 x 後，求Cu

[注意] 在最後一個時間點(leave node)的Cu不用內插，也沒辦法內插，由最單純的 call price 給出

#### 4. American-style and Single-barrier Issue

if(asianMTree[j][i][m] > H){
CTree[j][i][m] = 0;
}
else if( americanC > asianC ){
CTree[j][i][m] = americanC;
}
else{
CTree[j][i][m] = asianC;
}


CTree[0][0][0] 即為 American-style Asian single-barrier up-and-out calls Price.

### References

Y.-D. Lyuu - Principles of Financial Computing
http://www.csie.ntu.edu.tw/~lyuu/finance1.html

wiki - Binomial options pricing model
https://en.wikipedia.org/wiki/Binomial_options_pricing_model