[R-SIG-Finance] Plotting 2 option value lines

James jctoll at gmail.com
Tue May 8 05:48:44 CEST 2007


Hi,

I'm trying to learn how to use R to do some very basic things with  
the fOptions package.  At the moment I'm just trying to create a  
simple plot with two lines, one depicting the theoretical value of an  
option with time to expiration equal to approx. 3 months, and the  
other line depicting the value at expiration.  This is basically what  
I've done:

 > x <- (50:80)
 > c1 <- GBSOption(TypeFlag="c", S=x, X=65, Time=1/4, r=.08, b=.08,  
sigma=.3)@price
 > c2 <- GBSOption(TypeFlag="c", S=x, X=65, Time=0.000000001, r=.08,  
b=.08, sigma=.3)@price

I can then plot either

 > plot(x,c1, type="l")

or

 > plot(x,c2, type="l")

and get a decent plot.  But how do I create one plot with both  
lines?  Thanks for any help you can provide.

James


P.S.  I probably ought to ask this in a separate thread but what's  
the "proper" way of setting the Time such that the options are priced  
at expiration.  Setting time equal to 0 results in a price when the  
underlying is at the strike of N/A.  So as a kludge, I simply used  
Time=0.000000001.  Thanks



More information about the R-SIG-Finance mailing list