Algo Once pseudo-code實例: 股價指數期貨價格
2012/03/02 21:48
瀏覽303
迴響0
推薦0
引用0
使用虛擬碼來描述程式運算邏輯:
Algo Once pseudo-code 以類似VB 的語法及本國語言來描述
Algo Once pseudo-code is designed to describe the algorithm in local languages with VB style code.
by Chao-Yih Hsia (Mark Hsia) 2010/08/06
Example: 股價指數期貨價格
| $initflag=0 | ||||||
| if [現貨價格]==0 then | ||||||
| [現貨價格]=6500 | ||||||
| [無風險利率]=2.0 | ||||||
| [股利率]=6.0 | ||||||
| [距到期時間]=0.25 | ||||||
| $initflag=1 | ||||||
| end if | ||||||
| // FT=ST〔1+(r-d)×t〕 | ||||||
| [期貨價格]=[現貨價格]*(1+ ([無風險利率]/100.0-[股利率]/100.0) *[距到期時間]) | ||||||
| if $initflag==1 then | ||||||
| //initialized, need to verify result | ||||||
| if [期貨價格]==6435 then | ||||||
| {驗證結果}=起始驗證正確! | ||||||
| else | ||||||
| {驗證結果}=起始驗證錯誤! | ||||||
| end if | ||||||
| end if | ||||||
// CopyRight (c) 2010 Chao-Yih Hsia
你可能會有興趣的文章:
限會員,要發表迴響,請先登入










