Wolfram
Mathematica
8의 신기능: 금융 연산 기능 내장
◄
이전
|
다음
►
응용 분야
응용
FinancialDerivative
의 기능을 이용하여 주식 한 종목에 대한 합성 단기 매도 포지션을 구축 합니다.
이 플롯은 매도의 합성 단기 값이 시간과 가격의 변화에 따른 실제 매도 포지션 값을 자세히 추적하고있다는 것을 보여 줍니다.
In[1]:=
X
synth[a_, b_] := Block[{tab, lower, upper, pricec = FinancialDerivative[{"American", "Call"}, a, b, "Value"], pricep = FinancialDerivative[{"American", "Put"}, a, b, "Value"], deltac = FinancialDerivative[{"American", "Call"}, a, b, "Delta"], deltap = FinancialDerivative[{"American", "Put"}, a, b, "Delta"], gammac = FinancialDerivative[{"American", "Call"}, a, b, "Gamma"], gammap = FinancialDerivative[{"American", "Put"}, a, b, "Gamma"], qcall, qput, myParabolicApproximation, underlyingprice = "CurrentPrice" /. b, strikeprice = "StrikePrice" /. a, volatility = "Volatility" /. b, timetoexpiry = "Expiration" /. a, underlyingrange}, underlyingrange[number_] := underlyingprice + number*underlyingprice*volatility*Sqrt[timetoexpiry]; lower = underlyingprice - 1.5*strikeprice*volatility*Sqrt[timetoexpiry]; upper = underlyingprice + 1.5*strikeprice*volatility*Sqrt[timetoexpiry]; {qcall, qput} = {qc, qp} /. Flatten@Solve[-qc deltac + qp deltap == -1. && -qc gammac + qp gammap == 0, {qc, qp}]; tab = Transpose@ Flatten[Table[{{val, time, underlyingprice - val}, {val, time, qput (FinancialDerivative[{"American", "Put"}, a /. _["Expiration", _] :> Rule["Expiration", time], b /. _["CurrentPrice", _] :> Rule["CurrentPrice", val], "Value"] - pricep) - qcall (FinancialDerivative[{"American", "Call"}, a /. _["Expiration", _] :> Rule["Expiration", time], b /. _["CurrentPrice", _] :> Rule["CurrentPrice", val], "Value"] - pricec)}}, {val, lower, upper, (upper - lower)/81}, {time, "Expiration" /. a, ("Expiration" /. a)/ 2, -("Expiration" /. a)/40}], 1]; Column[{Spacer[30], Style["Total cost of synthetic short position: $" <> ToString[ qput pricep - qcall pricec], FontFamily -> "Georgia"], Spacer[30], ListPlot3D[tab, AxesLabel -> {"price", "time", "value"}, AxesOrigin -> {lower, 0}, ImageSize -> 425, Mesh -> None, PlotStyle -> {Directive[Orange, Specularity[White, 40]], Directive[LightBlue]}]}]]; synth[ {"StrikePrice" -> 40.00, "Expiration" -> 1, "Value" -> 13}, {"InterestRate" -> 0.01, "CurrentPrice" -> 50, "Dividend" -> 0.05, "Volatility" -> 0.40}]
Out[1]=