**1** Section 1: extract from the XML input **1**
....
<optioninfo>
<spot>100</spot>
<strike>105</strike>
<yield>0</yield>
<volatility>0</volatility>
<intRate>0.05</intRate>
<optStyle>AMERICAN</optStyle>
<callPut>PUT</callPut>
<busConv>ACT_365</busConv>
<valDate>19991015</valDate>
<matDate>20001015</matDate>
<currency>GBP</currency>
</optioninfo>
....
**2* Section 2: somewhere in the application a factory is
created and the option is priced **2**
....
try
{
WU_FactoryEquityOption1F factory
(buff,&container,XML_MEMORY);
factory.build();
WI_EquityOption1F *option = factory.getObject();
double price = option->price();
}
catch (WU_Exception ex)
{
outstr<<"User Exception : "
<<ex.getErrorMessage().c_str()
<<endl;
outstr<<"In context : "
<<ex.getContext().c_str()
<<ends;
}
.....
**3** Section 3: an extract from WU_FactoryEquityOption1F::build()
member function **3**
void WU_FactoryEquityOption1F::build()
{
.....
//instrument data
WD_InstrumentData idata;
string tmp;
tmp = getNodeValue("valDate"); //valuation date
//convert string into long
lv = strtol(tmp.c_str(),&failure,10);
if (strcmp(failure,"")!=0) throw ex;
idata.valDate = lv; //store in data structure
idata.spotDate = lv;
....
tmp = getNodeValue("strike"); //strike
//convert string into double
dv = strtod(tmp.c_str(),&failure);
if (strcmp(failure,"")!=0) throw ex;
idata.strike = dv;
....
// a subcomponent is assembled with other subcomponents
WM_AssetTree1D* pat;
pat =
new WM_AssetTree1D(dynamic_cast<WE_WillowTree1D*>(pwt1d),
intRate,
dynamic_cast<WU_DiscreteDivs*>(pdd));
....
//this component is cloned and the clone is stored
WU_Persistent* pat1d = pat->clone(); //cloning
m_container->registerComponent(pat1d,"AssetTree1D");
delete pat;
....
//finally the equity option is created and stored
// in m_object
m_object =
new WI_EquityOption1F
(idata,dynamic_cast<WM_AssetTree1D*>(pat1d));
....
}