\HeaderA{BarrierOption}{Barrier Option evaluation using Closed-Form solution}{BarrierOption}
\methaliasA{BarrierOption.default}{BarrierOption}{BarrierOption.default}
\keyword{misc}{BarrierOption}
\begin{Description}\relax
This function evaluations an Barrier option on a common stock
using a closed-form solution. The option value as well as the common first
derivatives (\"Greeks\") are returned.
\end{Description}
\begin{Usage}
\begin{verbatim}
## Default S3 method:
BarrierOption(barrType, type, underlying, strike,
                      dividendYield,
                      riskFreeRate, maturity, volatility,
                      barrier, rebate=0.0)

## S3 method for class 'Option':
print
## S3 method for class 'Option':
summary
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{barrType}] A string with one of the values \code{downin},
\code{downout}, \code{upin} or \code{upout}
\item[\code{type}] A string with one of the values \code{call} or \code{put}
\item[\code{underlying}] Current price of the underlying stock
\item[\code{strike}] Strike price of the option
\item[\code{dividendYield}] Continuous dividend yield (as a fraction) of the stock
\item[\code{riskFreeRate}] Risk-free rate
\item[\code{maturity}] Time to maturity (in fractional years)
\item[\code{volatility}] Volatility of the underlying stock
\item[\code{barrier}] Option barrier value
\item[\code{rebate}] Optional option rebate, defaults to 0.0
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
A closed-form solution is used to value the Barrier Option. In the
case of Barrier options, the calculations are from Haug's "Option
pricing formulas" book (McGraw-Hill).

Please see any decent Finance textbook for background reading, and
the \code{QuantLib} documentation for details on the \code{QuantLib}
implementation.
\end{Details}
\begin{Value}
An object of class \code{BarrierOption} (which inherits from class
\code{\LinkA{Option}{Option}}) is returned. It contains a list with the
following components: 
\begin{ldescription}
\item[\code{value}] Value of option
\item[\code{delta}] Sensitivity of the option value for a change in the underlying
\item[\code{gamma}] Sensitivity of the option delta for a change in the underlying
\item[\code{vega}] Sensitivity of the option value for a change in the
underlying's volatility
\item[\code{theta}] Sensitivity of the option value for a change in t, the
remaining time to maturity
\item[\code{rho}] Sensitivity of the option value for a change in the
risk-free interest rate
\item[\code{dividendRho}] Sensitivity of the option value for a change in the
dividend yield
\item[\code{parameters}] List with parameters with which object was created
\end{ldescription}
.

Note that under the new pricing framework used in QuantLib, binary
pricers do not provide analytics for 'Greeks'. This is expected to be
addressed in future releases of QuantLib.
\end{Value}
\begin{Note}\relax
The interface might change in future release as \code{QuantLib}
stabilises its own API.
\end{Note}
\begin{Author}\relax
Dirk Eddelbuettel \email{edd@debian.org} for the \R{} interface;
the QuantLib Group for \code{QuantLib}
\end{Author}
\begin{References}\relax
\url{http://quantlib.org} for details on \code{QuantLib}.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{AmericanOption}{AmericanOption}},\code{\LinkA{EuropeanOption}{EuropeanOption}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
BarrierOption(barrType="downin", type="call", underlying=100,
        strike=100, dividendYield=0.02, riskFreeRate=0.03,
        maturity=0.5, volatility=0.4, barrier=90)
\end{ExampleCode}
\end{Examples}

