Big Mac's 的頭像

得閒會研究吓啲外星人文明, 同教啲小動物講廣東話.

BS Option Model

陶公公,幫手check 吓!! 下面的source code 是網上找回來的,計出來好似有啲問題,以你的聰明才智應該可以找到有冇錯嘢。我在努力中,還有幾天可以趕。 你copy 以後我會把它delete.

所有評論

Big Mac - 2010年02月19日 12:56

! Subroutine Calculate the Option Price

Subroutine BlackScholes(CallPutFlag, S, X, T, r, v, Option_Price)
!Real*8 Function BlackScholes(CallPutFlag, S, X, T, r, v)
character*1 CallPutFlag
real*8 S,X,T,r,v, Option_Price
real*8 d1, d2

d1 = (Log(S / X) + (r + v**2. / 2.) * T) / (v * Sqrt(T))
d2 = d1 - v * Sqrt(T) !70

If (CallPutFlag.eq.'c') Then
! BlackScholes = S * CND(d1) - X * Exp(-r * T) * CND(d2)
Option_Price = S * CND(d1) - X * Exp(-r * T) * CND(d2)
ElseIf( CallPutFlag.eq.'p') Then
! BlackScholes = X * Exp(-r * T) * CND(-d2) - S * CND(-d1)
Option_Price = X * Exp(-r * T) * CND(-d2) - S * CND(-d1)
End If

Return !80
End
! The cumulative normal distribution function
Function CND(X)

! Real*8 Function CND(X)

PARAMETER (DPI=3.141592653589793238D0)

real*8 X
real*8 L, K
real*8 a1,a2,a3,a4,a5

a1 = 0.31938153
a2 = -0.356563782
a3 = 1.781477937
a4 = -1.821255978
a5 = 1.330274429

L = Abs(X)
K = 1. / (1. + 0.2316419 * L)
CND = 1. -1./Sqrt(2.*DPI)*Exp(-L**2./2.)*(a1*K+a2*K**2.+a3*K**3.+a4*K**4.+a5*K**5.)
! 1 (a1 * K + a2 * K**2. + a3 * K**3. + a4 * K**4. + a5 * K**5.)

If (X.lt.0.) Then
CND = 1. - CND
End If

Return
End

Big Mac - 2010年02月19日 12:58

Just ignore the statement with "!" in the front. Will come back after lunch!!

陶尚 - 2010年02月19日 14:05

巴打,新年快樂!
Please e-mail: [email protected]

Big Mac - 2010年02月19日 14:06

Here are some of the results using this subroutine with "Risk free interest= 1%" and Volatility = 40% .

The first column is "Item" second one is " HSBC Spot Price", the third column is "Option Strike Price" and the last column is "calculated Option Price".
Obvious the calculated results are much higher than the actual one.

Time to Maturity 30 days
1 75.50 70.00 72.87
2 76.00 70.00 73.36
3 76.50 70.00 73.86
4 77.00 70.00 74.36
5 77.50 70.00 74.85
6 78.00 70.00 75.35

Big Mac - 2010年02月19日 14:10

Okay, I will title the mail with "I am Big Mac" in French.

Don't disclose my real name in here, thanks!!

Big Mac - 2010年02月19日 14:14

Did you get the code yet? I am going to delete it with your email address!!

Big Mac - 2010年02月19日 14:26

I am going to work on it, come back soon!!

陶尚 - 2010年02月19日 14:26

I have sent you my mobile and e-mail. BTW, I suddenly want to have a Big Mac....

Big Mac - 2010年02月19日 14:59

Go ahead and make my day!!
Here is the latest result, the last one is the calculate “put”; it makes more sense.

Time to Maturity 30 days
1 75.50 70.00 72.87 .85
2 76.00 70.00 73.36 .85
3 76.50 70.00 73.86 .84
4 77.00 70.00 74.36 .84
5 77.50 70.00 74.85 .84
6 78.00 70.00 75.35 .84
7 78.50 70.00 75.85 .83
8 79.00 70.00 76.34 .83

Time to Maturity 11 days
1 75.50 70.00 57.22 5.02
2 76.00 70.00 57.69 4.99
3 76.50 70.00 58.16 4.96
4 77.00 70.00 58.63 4.93
5 77.50 70.00 59.10 4.90

Time to Maturity 1 days
1 75.50 70.00 18.11 5.95
2 76.00 70.00 18.48 5.82
3 76.50 70.00 18.86 5.69
4 77.00 70.00 19.23 5.57
5 77.50 70.00 19.61 5.45

but getting more non-sense as the time value dies out. Do you think so?

Big Mac - 2010年02月19日 15:02

Here is the link of delayed quote of HSBC option price.
Option quote

Big Mac - 2010年02月19日 16:55

陶尚公: The volatility is a very important parameter in option trading, do you know what would be the range of it for most of the companies?

I am leaving soon, I may come back later tonight!!

陶尚 - 2010年02月19日 17:14

Please see my e-mail on possible bug of your programme.

Also, I have made something new for sharing:

1. The first is the combined calculator for B-S and Implied Volatility.
2. IV quote from HKEX
3. Historical Volatility Calculator for reference.

You may also find the same from Bloomberg.com
Options Price & Implied Volatility Calculator
HKEX Option IV Quote
资产价格波动计算器

陶尚 - 2010年02月19日 17:29

I can see the problem with the time, have you divided the day by 365?

Big Mac - 2010年02月20日 01:46

May be you are right, i.e. the time divides by 365 but I haven't check that in detail. I modified the program, the results make more sense.

Time to Maturity 30 days
1 75.50 70.00 7.20 1.12
2 76.00 70.00 7.59 1.02
3 76.50 70.00 8.00 .92
4 77.00 70.00 8.41 .84
5 77.50 70.00 8.83 .76

Time to Maturity 15 days
1 75.50 70.00 6.29 .51
2 76.00 70.00 6.72 .43
3 76.50 70.00 7.16 .37
4 77.00 70.00 7.60 .32
5 77.50 70.00 8.05 .27

Time to Maturity 1 days
1 75.50 70.00 5.52 .00
2 76.00 70.00 6.02 .00
3 76.50 70.00 6.52 .00
4 77.00 70.00 7.02 .00
5 77.50 70.00 7.52 .00

陶尚 - 2010年02月20日 08:04

Fine. But do not have full trust of B-S for it too have limitations.

Big Mac - 2010年02月20日 14:53

True, especially the option trading in HK is so thin and easy being manipulated. But use the BS model to bs around is not a bad idea. :)

只有登入後或登記成為會員才能發表意見

版規:

  1. 網站編輯或網站作家開題,網友可回應。回應必須貼題,請勿重覆;勿發表誹謗,人身攻擊或不雅內容。
  2. 網站編輯有權發表或不發表網友張貼的內容。(請參閱議論守則)
  3. 開題之網友可編輯其在過去7天內發表之論題,或刪除相關回應。

查閱 FAQ

信報簡介 | 服務條款 | 私隱條款 | 免責聲明 | 廣告查詢 | 信報會議中心租賃 | 加入信報 | 聯絡信報

股票及指數資料由財經智珠網有限公司提供。期貨指數資料由天滙財經有限公司提供。外滙及黃金報價由路透社提供。

本網站的內容概不構成任何投資意見,本網站內容亦並非就任何個別投資者的特定投資目標、財務狀況及個別需要而編製。投資者不應只按本網站內容進行投資。在作出任何投資決定前,投資者應考慮產品的特點、其本身的投資目標、可承受的風險程度及其他因素,並適當地尋求獨立的財務及專業意見。本網站及其資訊供應商竭力提供準確而可靠的資料,但並不保證資料絕對無誤,資料如有錯漏而令閣下蒙受損失,本公司概不負責。