2017-05-04 10 views
0

私は初心者です。 私は暗黙のボラティリティを計算したいと思います。(SAS)オプションprocモデルなどを使用した暗黙のボラティリティ計算

私がしたいので、各行は、別のオプションの情報を持っている

Option_code/put_call_idx/underlying_price/dividend_yield /成熟/ option_premium/strike_price /など

A/"PUT"/1000/0.5/13/5/980/....... 
B/"CALL"/1000/0.5/13/10/990/....... 

以下のように私のデータセットが見えます私の最終的な データセットを、以下の形式の暗黙のボラティリティを解いて得てください。

A/"PUT"/1000/0.5/13/....../**0.15 (IV for option A)** 
B/"CALL"/1000/0.5/13/....../**0.18 (IV for option B)** 

私の汚いコードは、いくつかの行を実行した後、この


proc model data = INPUT noprint; 

exogenous ksp200 ksp200_div ttm strike_prc rf; 

endogenous iv; 

n_1 = log(ksp200 * exp((rf - ksp200_div) * (ttm/250))/strke_price 

.... other Black-Scholes Formula input ....... 

0 = abs(model price - market price) 

solve iv/maxiter = 100 converge = 0.1 out = iv_root; 
by option_code; 

run; 

のように見える右のソリューションを提供していますが、エラーメッセージがいくつかの観測がニュートン後の溶液を持っていないこと 意味を持ちますメソッド反復。

私は実際の取引所見積りからのデータはエラーメッセージが私には合わないと思います。だから、私の面倒なコードやメソッドは、定義上間違っていますか?インプライド・ボラティリティを計算するための代替案があるか?

引用または参照ページを教えてください。

答えて

0

私はこの問題を多く扱っています。多くの場合、オプションの引用符は古く、意味をなさない。暗黙のボラティリティを解くことを試みると、解はIV = 0で境界にヒットします。たとえば、単純な呼び出しは$ 5で引用されていますが、$ 6です。意味のない値をチェックし、それを処理する方法を見つける必要があります。

私はあなたのPROC MODELメソッドを好きです。個人的には、私はPROC FCMPを使って私自身の関数に入れて、データステップを使用します。 FCMPには、ルートを見つけることができるSOLVE関数があります。

proc fcmp outlib=work.fns.options; 

/*Taken from Wikipedia - BS with a continous dividend*/ 
function optPrc(type $, K,S,q,r,ttm,vol); 
    d1 = (1/(vol*sqrt(ttm)))*(log(S/K)+(r-q+.5*vol**2)*ttm); 
    d2 = d1-(vol*sqrt(ttm)); 
    F=S*exp((r-q)*ttm); 
    ert = exp(-r*ttm); 
    prc = .; 
    if upcase(substr(type,1,1)) = "C" then 
     prc = ert*(F*cdf('NORMAL',d1,0,1)-K*cdf('NORMAL',d2,0,1)); 
    else if upcase(substr(type,1,1)) = "P" then 
     prc = ert*(K*cdf('NORMAL',-d2,0,1)-F*cdf('NORMAL',-d1,0,1)); 

    return(prc); 

endsub; 

/*IV Solver*/ 
function opt_iv(type $, K,S,q,r,ttm,opt_prc); 

    iv = .; 
    prc = optPrc(type , K,S,q,r,ttm,1e-8); 
    if opt_prc < prc then do; 
     PUT "ERROR: Option Price out of bounds" opt_prc= prc= "at 0 vol"; 
    end; 
    else do; 
     array opts[5] initial abconv relconv maxiter status 
         (.5 .001 1.0e-6 100  -1); 

     iv = solve("optPrc",opts, opt_prc, type , K, S, q, r, ttm, .); 
     if status ^= 0 then 
      PUT "ERROR: Problem Solving." STATUS=; 
    end; 

    return (iv); 
endsub; 

run; 
quit; 

options cmplib=(work.fns); 

data test; 
Type = "PUT"; 
Underlying = 1000; 
Div_Yield = 0.5; 
Maturity = 13; 
Opt_Prc=5; 
Strike=980; 
output; 
Type = "CALL"; 
Underlying = 1000; 
Div_Yield = 0.5; 
Maturity = 13; 
Opt_Prc=10; 
Strike=990; 
output; 

/*This obviously is bad - call is $10 in the money, but quoted at 5*/ 
Type = "CALL"; 
Underlying = 1000; 
Div_Yield = 0; 
Maturity = 13; 
Opt_Prc=5; 
Strike=990; 
output; 


/*This obviously is put - put is $10 in the money, but quoted at 5*/ 
Type = "PUT"; 
Underlying = 1000; 
Div_Yield = 0; 
Maturity = 13; 
Opt_Prc=5; 
Strike=1010; 
output; 
run; 


data test2; 
set test; 

iv= opt_iv(type, Strike,Underlying,Div_Yield/100,0.005,Maturity/250,Opt_Prc); 
run; 
関連する問題