[R-SIG-Finance] [SPAM] - fOptions American options Implied Volatility - Email found in subject

David Reiner David.Reiner at xrtrading.com
Tue May 17 15:44:41 CEST 2011


Massimo,
This stock has dividends, so you might have to use a different valuation model for American valuation.
Some sort of discrete dividend model should work.
HTH,
-- David


-----Original Message-----
From: r-sig-finance-bounces at r-project.org [mailto:r-sig-finance-bounces at r-project.org] On Behalf Of msalese
Sent: Tuesday, May 17, 2011 4:37 AM
To: r-sig-finance at r-project.org
Subject: [SPAM] - [R-SIG-Finance] fOptions American options Implied Volatility - Email found in subject

Hi guys,
working with RMetrics/fOptions library I see there isn't a function to
compute iv on American Options so I've build this function to do the job:

library(fOptions)

impVolAmCall<-function(pmkPrice,Und,Strike,expTime,rInt,pb){
  auxAmCall<-function(pVol,pmkPrice,pUnd,pStrike,pexpTime,prInt){
    at<-CRRBinomialTreeOption(TypeFlag = "ca", S = pUnd, X=pStrike,Time
=pexpTime, r = prInt, b = pb, sigma = pVol, n = 15)
    return(pmkPrice-at at price)
  }

limpVol<-uniroot(f=auxAmCall,lower=0.05,upper=2,tol=0.001,pmkPrice=pmkPrice,pUnd=Und,pStrike=Strike,pexpTime=expTime,prInt=rInt)
  return(limpVol$root)
}

After that I downloaded options price from Italian IDEM on G.MI (Generali
Assurance) and loaded all in the obsPrice3 data.frame:

str(obsPrice3)
'data.frame':   12 obs. of  6 variables:
 $ expDays : num  59 59 59 59 59 59 59 59 59 59 ...
 $ YExpDays: num  0.234 0.234 0.234 0.234 0.234 ...
 $ Bid     : num  2.219 1.726 1.249 0.845 0.544 ...
 $ Ask     : num  2.266 1.769 1.293 0.883 0.579 ...
 $ Strike  : num  13.5 14 14.5 15 15.5 16 16.5 17 17.5 18 ...
 $ MidPrice: num  2.242 1.747 1.271 0.864 0.561 ...


expDays YExpDays    Bid    Ask Strike MidPrice
1       59 0.234127 2.2190 2.2660   13.5  2.24250
2       59 0.234127 1.7255 1.7690   14.0  1.74725
3       59 0.234127 1.2490 1.2930   14.5  1.27100
4       59 0.234127 0.8450 0.8830   15.0  0.86400
5       59 0.234127 0.5445 0.5785   15.5  0.56150
6       59 0.234127 0.3325 0.3670   16.0  0.34975
7       59 0.234127 0.1895 0.2180   16.5  0.20375
8       59 0.234127 0.1010 0.1280   17.0  0.11450
9       59 0.234127 0.0485 0.0760   17.5  0.06225
10      59 0.234127 0.0115 0.0445   18.0  0.02800
11      59 0.234127 0.0005 0.0830   18.5  0.04175
12      59 0.234127 0.0005 0.0775   19.0  0.03900

Now I'd like to compute the iv for all the chain so I've used mapply:

mapply(FUN=impVolAmCall,obsPrice3$MidPrice,obsPrice3$Strike,Und=15.75,expTime=59/252,rInt=0.01,pb=0.01)
but R replay with:

Error in uniroot(f = auxAmCall, lower = 0.05, upper = 2, tol = 0.001,  :
  f() values at end points not of opposite sign

The point is that for otm options I'm not able to find zero in auxAmCall
(auxiliary function) coded inside impVolAmCall function.
I'm new to R so I think that something is wrong in my code, can someone help
me ?

Thanks
Massimo
http://r.789695.n4.nabble.com/file/n3528629/obsPrice3.rda obsPrice3.rda

--
View this message in context: http://r.789695.n4.nabble.com/fOptions-American-options-Implied-Volatility-tp3528629p3528629.html
Sent from the Rmetrics mailing list archive at Nabble.com.

_______________________________________________
R-SIG-Finance at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.


This e-mail and any materials attached hereto, including, without limitation, all content hereof and thereof (collectively, "XR Content") are confidential and proprietary to XR Trading, LLC ("XR") and/or its affiliates, and are protected by intellectual property laws.  Without the prior written consent of XR, the XR Content may not (i) be disclosed to any third party or (ii) be reproduced or otherwise used by anyone other than current employees of XR or its affiliates, on behalf of XR or its affiliates.

THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.



More information about the R-SIG-Finance mailing list