LoginSignup
6
3

More than 5 years have passed since last update.

ブラック・ショールズ方程式からオプションのインプライド・ボラティリティを求めるマクロ

Posted at

BS式からIVを逆算するマクロを作成

はじめに

ブラック・ショールズ方程式(以下BS式)を用いて、オプションのインプライドボラティリティ(以下IV)を求めるマクロを作成したので、情報を共有します。
なぜCやJavaではなくマクロなのか?それは楽天RSSでの使用を前提としているからです。

BS式とは

BS式とは何か?という人はそもそもこの記事自体を読んでいないと思いますが、念のため参考URLを掲載しておきます。
ブラック・ショールズ・モデル(BS式) - 金融キーワード解説 | シグマインベストメントスクール

BS式では、原資産価格や権利行使価格、IV等からオプションの理論価格を求めますが、今回は
オプションに現在ついている価格、原資産価格、権利行使価格等からIVを逆算します。

どうやって逆算する?

二分法という手法を用います。
この記事で書いてもよいのですが、既に分かりやすく解説されている方がいるのでリンクを貼っておきます
2分法の理論と実装

成果物(ソースコード)

' コールオプションのIVを求める
' assetPrice    原資産価格
' optionPrice   オプションの価格
' strikePrice   権利行使価格
' rate          金利
' t             残存期間(年)
Function Call_IV(assetPrice As Double, optionPrice As Double, strikePrice As Double, rate As Double, t As Double) As Double
Dim startiv As Double
Dim midiv As Double
Dim endiv As Double
startiv = 0.00001
endiv = 1

Dim startf As Double
Dim midf As Double
Dim endf As Double
startf = Call_Buy_OptionPrice(assetPrice, optionPrice, strikePrice, rate, startiv, t)
endf = Call_Buy_OptionPrice(assetPrice, optionPrice, strikePrice, rate, endiv, t)

Do
    ' 二分法で損益分岐点を求める
    ' 中点の値を求める
    midiv = (startiv + endiv) / 2
    midf = Call_Buy_OptionPrice(assetPrice, optionPrice, strikePrice, rate, midiv, t)

    ' 前半に解がある場合
    If startf * midf < 0 Then
        endiv = midiv
        endf = midf
    Else
    ' 後半に解がある場合
        startiv = midiv
        endf = midf
    End If
Loop While Abs(startiv - endiv) > 0.0000001

Call_IV = midiv

End Function
6
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3