A typical calculator add-in, which values vanilla options
This simple add-in contains a calculator for calculating the value and derivatives of a vanilla option.
It is typical of financial calculator add-ins, and offers a useful model for an XLL+ add-in which makes use of existing pure C libraries.
The sample displays the following features:
The following steps were significant in creating and completing the SimpOpt application.
This project was upgraded from XLL+ 5.0 using the
Upgrade Wizard.
You can find the old version in the Backup
directory
underneath the project directory.
One (repeated) line of code was incompatible, and had to be changed by hand.
The calls to CXlOper::CallAddin() originally looked like this:
// Call the array version of the function
CXlOper xloCalc;
xloCalc.CallAddin(BsCalc(Spot, Put, Div, Borrow, ImpVol,
Strike, ValueDate, Maturity, RiskFree, DayCount));
The implementation function was renamed to BsCalc_Impl
,
and takes an extra first argument, xloResult
, into
which the result is put.
The new version of the code therefore lookes like:
// Call the array version of the function
CXlOper xloCalc;
xloCalc.CallAddin(BsCalc_Impl(xloCalc, Spot, Put, Div, Borrow, ImpVol,
Strike, ValueDate, Maturity, RiskFree, DayCount));
See Breaking changes in the User Guide for more information.
CXlOper::IsDouble | CXlOper::ToDouble | CXlOper::IsArray | CXlOper::GetWidth | CXlOper::ReadVector | CXlOper::AllocArray | CXlOper::IsArray | CXlOper::Cell | CXlOper::CallAddin | CXlOper::RetString | CXlOper::Ret | ::XllGetTypedApp | CXlOperCache::Clear | ::XlLSerialToDate | ::XlDateToLSerial
Each sample project is located in a sub-directory of the Samples directory of the XLL+ installation. To use the sample project, open the solution file SimpOpt.sln or the project file SimpOpt.vcproj.
You can enable debugging under Excel by using the Setup Debugging command in the XLL+ ToolWindow.
When delivered, the help files are excluded from the build.
You can enable the help build by selecting the files
SimpOpt.help.xml
and
SimpOpt.chm
in the Solution Explorer,
and using the right-click menu to view Properties.
Select the page "Configuration Properties/General" and
set the "Excluded from build" property to "No".
See Generating help
in the User Guide for more information.