- UID
- 2
- 积分
- 2874664
- 威望
- 1387361 布
- 龙e币
- 1487303 刀
- 在线时间
- 13156 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-11-24
|
【ImpliedVolatility】
- inputs:
- ExpMonth( numericsimple ),
- ExpYear( numericsimple ),
- StrikePr( numericsimple ),
- Rate100( numericsimple ),
- MktVal( numericsimple ),
- PutCall( numericsimple ),
- AssetPr( numericsimple ) ;
- variables:
- var0( 0 ),
- var1( 0 ),
- var2( 0 ),
- var3( 0 ),
- var4( 0 ) ;
- var0 = DaysToExpiration( ExpMonth, ExpYear ) ;
- condition1 = var0 > 0 and StrikePr > 0 and AssetPr > 0 ;
- if condition1 then
- begin
- var1 = 100 ;
- var2 = BlackScholes( var0, StrikePr, AssetPr, Rate100, var1,
- PutCall ) ;
- while var2 < MktVal and var1 <= 900
- begin
- var1 = var1 + 100 ;
- var2 = BlackScholes( var0, StrikePr, AssetPr, Rate100, var1,
- PutCall ) ;
- end ;
- if var2 < MktVal then
- ImpliedVolatility = 999
- else
- begin
- var3 = 1 ;
- var4 = 100 ;
- while AbsValue( var2 - MktVal ) >= .005 and var3 < 11
-
-
- begin
- var4 = var4 * .5 ;
- if var2 > MktVal then
- var1 = var1 - var4
- else if var2 < MktVal then
- var1 = var1 + var4 ;
- var2 = BlackScholes( var0, StrikePr, AssetPr, Rate100, var1,
- PutCall ) ;
- var3 = var3 + 1 ;
- end ;
- ImpliedVolatility = var1 ;
- end ;
- end
- else
- ImpliedVolatility = 0 ;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|