0

I need help with plotting next two graphs. I don't know how to combine all these formulas to make a graph. I need a graph for different values of S (which is stock price) in range (500,1500). Formulas for call and put option is

$\pi_C = exp(-r(T-t_0))(FN(d_1)-KN(d_2))$
$\pi_p = exp(-r(T-t_0))(KN(-d_2)-FN(-d_1))$ 

which graphs I need

where F is $F = S*exp(r(T-t_0))$

$d_1 = \frac{\ln\left({\frac{F}{K}}\right) + \frac{1}{2}\sigma^2(T-t_0)}{\sigma\sqrt{T-t_0}}$
$d_2 = \frac{\ln\left({\frac{F}{K}}\right) - \frac{1}{2}\sigma^2(T-t_0)}{\sigma\sqrt{T-t_0}}$

and fixed values are K = 1000, T = 1, t_0 = 0, r = 0.02, \sigma = 0.2 , and N stands for cumulative standard normal (Gauss) distribution.

\documentclass[a4 paper, 12pt]{article}
\usepackage{pgfplots}
\setlength{\baselineskip}{17pt}
\usepackage{geometry}
\usepackage[croatian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[unicode]{hyperref}
\usepackage{floatrow}
\usepackage[final]{pdfpages}
\geometry{a4paper,
left=25mm,right=20mm,top=25mm,bottom=25mm}
\usepackage{multirow}
\usepackage{tabularx,ragged2e,booktabs,caption}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{mathtools}
\usepackage{chngcntr}
\usepackage{tikz}
\usetikzlibrary{datavisualization}
\usetikzlibrary{datavisualization.formats.functions}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\usepackage{enumitem}
\usepackage{subfig}
\usepackage{array}
\usepackage{lipsum}
\graphicspath{{images/}}
\theoremstyle{plain}
\newtheorem{defn}{Definicija}[section]
\newtheorem{nap}{Napomena}[section]
\newtheorem{thm}{Teorem}[section]
\newtheorem{prop}{Propozicija}[section]
\newtheorem{krl}{Korolar}[section]
\newtheorem{lema}{Lema}[section]
\theoremstyle{definition}
\newtheorem{pr}{Primjer}[section]
\numberwithin{equation}{section}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
    declare function={
        K=1000;
        r=0.02;
        sigma=0.2;
        T=1;
        t0=0;
        F(\x)=(\x)*exp(r(T-t0));
        d1=(ln(F/K)+0.5*sigma*sigma*(T-t0))/(sigma*sqrt(T-t0));
        d2=(ln(F/K)-0.5*sigma*sigma*(T-t0))/(sigma*sqrt(T-t0));
        pi_c= exp(-r(T-t0))*(F*N(d1)-K*N(d2));
        pi_p= exp(-r(T-t0))*(K*N(-d2)-F*N(-d1));
    },
]

    \addplot+ ;
\end{axis}
\end{tikzpicture}

\end{document}

edit: I add code for plotting. N will be cumulative distribution function of standard normal and I dont know how to make it.. formula for N(x) is $\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{x} exp{\frac{-t^2}{2}}dt$, and I need graphs of pi_c and pi_p

8
  • See pgfplots package. In documentation are plenty of examples, how to draw diagrams,. Also search in this site for pgfplots and draw functions. – Zarko Sep 28 '20 at 15:17
  • What is your desired image? – user213378 Sep 28 '20 at 15:32
  • image of two graphs in one, one for call and one for put option, x label is stock price S, and y label is valeu of call and put option – kileuskas Sep 28 '20 at 15:35
  • @kileuskas Can you show the visible desired image? – user213378 Sep 28 '20 at 16:38
  • That's a lot in your preamble. Pro tip: extra long preambles should go to an extra file. – Someone Sep 28 '20 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.