Thanks for replies. Cant believe I forgot to discount… Working function if anybody is interested:

vaEurVanillaCallInt <- function(S0, K, r, q, T, vol){
# vaEurVanillaCallInt(100, 100, 0.05, 0.01, 1, 0.1)
    min <- (log(K/S0) - (r-q-vol*vol/2))/vol
    fun <- function(x){
        pmax((S0*exp( (r - q - vol*vol/2)*T + vol * sqrt(T) * x) - K),0) * dnorm(x)}
    exp(-r*T)*integrate(fun, min, 20)$value}



On itself it is pretty much worthless. However, numerical integration becomes useful when pricing exotics or levy processes via FFTs.  


Kind regards,--  
Dominykas Grigonis


On Saturday, 13 April 2013 at 19:34, Nikos Rachmanis wrote:

> Assuming t=1, you forgot to discount
>  
> updating the function
>  
> fun <- function(x, K=100)
> {
> (gbm(x) - 100) * dnorm(x) * exp(-0.05)
> }
>  
> should give you the result you want.
>  
> Nikos
>  
> On 4/13/2013 6:00 AM, r-sig-finance-request@r-project.org (mailto:r-sig-finance-request@r-project.org) wrote:
> > Today's Topics:
> >  
> > 1. euro call by integration (Dominykas Grigonis)
> >  
> >  
> > ----------------------------------------------------------------------
> >  
> > Message: 1
> > Date: Sat, 13 Apr 2013 07:42:23 +0100
> > From: Dominykas Grigonis <dominykasgrigonis@gmail.com (mailto:dominykasgrigonis@gmail.com)>
> > To: r-sig-finance <r-sig-finance@r-project.org (mailto:r-sig-finance@r-project.org)>
> > Subject: [R-SIG-Finance] euro call by integration
> > Message-ID: <31AE529DE9C041BEB5DEEC9B6837B355@gmail.com (mailto:31AE529DE9C041BEB5DEEC9B6837B355@gmail.com)>
> > Content-Type: text/plain
> >  
> > Valuing european call option by taking expectation and integrating:
> >  
> > gmb <- function(x,s0=100,r=0.05,vol=0.1){
> > s0*exp( (r - vol^2/2) + vol * x)}
> >  
> > fun <- function(x, K=100){
> > (gbm(x) - 100) * dnorm(x)}
> >  
> > min = -(log(1) + (0.05-0.1^2/2)) / 0.1
> > integrate(fun,min,Inf)
> >  
> > could someone tell me what am I doing wrong? I do not even know if this is R related question or not...
> >  
> > returns 7.153855, while actual risk neutral price is 6.804958
> >  
> > Thank you in advance.
> >  
> > Kind regards,--
> > Dominykas Grigonis
> >  
> >  
> > [[alternative HTML version deleted]]
> >  
> >  
> >  
> > ------------------------------
> >  
> > _______________________________________________
> > R-SIG-Finance mailing list
> > R-SIG-Finance@r-project.org (mailto:R-SIG-Finance@r-project.org)
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >  
> >  
> > End of R-SIG-Finance Digest, Vol 107, Issue 11
> > **********************************************
> >  
>  
>  
>  



	[[alternative HTML version deleted]]

