void BarrierOption::arguments::validate() const { OneAssetOption::arguments::validate(); switch (barrierType) { case Barrier::DownIn: case Barrier::UpIn: case Barrier::DownOut: case Barrier::UpOut: break; default: QL_FAIL("unknown type"); } QL_REQUIRE(barrier != Null<Real>(), "no barrier given"); QL_REQUIRE(rebate != Null<Real>(), "no rebate given"); }
// gets a price that can include an arbitrary number of basis curves inline Real CommodityCurve::price( const Date& d, const boost::shared_ptr<ExchangeContracts>& exchangeContracts, Integer nearbyOffset) const { Date date = nearbyOffset > 0 ? underlyingPriceDate(d, exchangeContracts, nearbyOffset) : d; Time t = timeFromReference(date); Real priceValue = 0; try { priceValue = priceImpl(t); } catch (const std::exception& e) { QL_FAIL("error retrieving price for curve [" << name() << "]: " << e.what()); } return priceValue + basisOfPriceImpl(t); }
std::vector<Real> cap_floor(Date evaluationDate, CapFloor::Type type, Real strike, Real nominal, Schedule schedule, Natural fixingDays, BusinessDayConvention convention, boost::shared_ptr<IborIndex> index, boost::shared_ptr<YieldTermStructure> termStructure, Volatility volatility) { Date todaysDate = evaluationDate; Settings::instance().evaluationDate() = todaysDate; std::vector<Real> nominals = std::vector<Real>(1, nominal); /*Make Leg*/ Leg leg = IborLeg(schedule, index) .withNotionals(nominals) .withPaymentDayCounter(index->dayCounter()) .withPaymentAdjustment(convention) .withFixingDays(fixingDays); /*Make Engine*/ Handle<Quote> vol(boost::shared_ptr<Quote>(new SimpleQuote(volatility))); boost::shared_ptr<PricingEngine> engine = boost::shared_ptr<PricingEngine>(new BlackCapFloorEngine(Handle<YieldTermStructure>(termStructure), vol)); /*Pricing*/ boost::shared_ptr<CapFloor> testProduct; switch (type) { case CapFloor::Cap: testProduct = boost::shared_ptr<CapFloor>(new Cap(leg, std::vector<Rate>(1, strike))); break; case CapFloor::Floor: testProduct = boost::shared_ptr<CapFloor>(new Floor(leg, std::vector<Rate>(1, strike))); break; default: QL_FAIL("unknown cap/floor type"); } testProduct->setPricingEngine(engine); std::vector<Real> rst; rst.push_back(testProduct->NPV()); return rst; }
Date Date::advance(const Date& date, Integer n, TimeUnit units) { switch (units) { case Days: return date + n; case Weeks: return date + 7*n; case Months: { Day d = date.dayOfMonth(); Integer m = Integer(date.month())+n; Year y = date.year(); while (m > 12) { m -= 12; y += 1; } while (m < 1) { m += 12; y -= 1; } QL_ENSURE(y >= 1900 && y <= 2199, "year " << y << " out of bounds. " << "It must be in [1901,2199]"); Integer length = monthLength(Month(m), isLeap(y)); if (d > length) d = length; return Date(d, Month(m), y); } case Years: { Day d = date.dayOfMonth(); Month m = date.month(); Year y = date.year()+n; QL_ENSURE(y >= 1900 && y <= 2199, "year " << y << " out of bounds. " << "It must be in [1901,2199]"); if (d == 29 && m == February && !isLeap(y)) d = 28; return Date(d,m,y); } default: QL_FAIL("undefined time units"); } }
Decimal operator/(const Money& m1, const Money& m2) { if (m1.currency() == m2.currency()) { return m1.value()/m2.value(); } else if (Money::conversionType == Money::BaseCurrencyConversion) { Money tmp1 = m1; convertToBase(tmp1); Money tmp2 = m2; convertToBase(tmp2); return tmp1/tmp2; } else if (Money::conversionType == Money::AutomatedConversion) { Money tmp = m2; convertTo(tmp, m1.currency()); return m1/tmp; } else { QL_FAIL("currency mismatch and no conversion specified"); } }
Money& Money::operator-=(const Money& m) { if (currency_ == m.currency_) { value_ -= m.value_; } else if (Money::conversionType == Money::BaseCurrencyConversion) { convertToBase(*this); Money tmp = m; convertToBase(tmp); *this -= tmp; } else if (Money::conversionType == Money::AutomatedConversion) { Money tmp = m; convertTo(tmp, currency_); *this -= tmp; } else { QL_FAIL("currency mismatch and no conversion specified"); } return *this; }
bool close_enough(const Money& m1, const Money& m2, Size n) { if (m1.currency() == m2.currency()) { return close_enough(m1.value(),m2.value(),n); } else if (Money::conversionType == Money::BaseCurrencyConversion) { Money tmp1 = m1; convertToBase(tmp1); Money tmp2 = m2; convertToBase(tmp2); return close_enough(tmp1,tmp2,n); } else if (Money::conversionType == Money::AutomatedConversion) { Money tmp = m2; convertTo(tmp, m1.currency()); return close_enough(m1,tmp,n); } else { QL_FAIL("currency mismatch and no conversion specified"); } }
void BlackCalculator::Calculator::visit(CashOrNothingPayoff& payoff) { black_.alpha_ = black_.DalphaDd1_ = 0.0; black_.x_ = payoff.cashPayoff(); black_.DxDstrike_ = 0.0; switch (payoff.optionType()) { case Option::Call: black_.beta_ = black_.cum_d2_; black_.DbetaDd2_ = black_.n_d2_; break; case Option::Put: black_.beta_ = 1.0-black_.cum_d2_; black_.DbetaDd2_ = -black_.n_d2_; break; default: QL_FAIL("invalid option type"); } }
std::vector<boost::function1<Real, Real> > LsmBasisSystem::pathBasisSystem(Size order, PolynomType polynomType) { std::vector<boost::function1<Real, Real> > ret; for (Size i=0; i<=order; ++i) { switch (polynomType) { case Monomial: ret.push_back(MonomialFct(i)); break; case Laguerre: ret.push_back( bind(&GaussianOrthogonalPolynomial::weightedValue, GaussLaguerrePolynomial(), i, _1)); break; case Hermite: ret.push_back( bind(&GaussianOrthogonalPolynomial::weightedValue, GaussHermitePolynomial(), i, _1)); break; case Hyperbolic: ret.push_back( bind(&GaussianOrthogonalPolynomial::weightedValue, GaussHyperbolicPolynomial(), i, _1)); break; case Legendre: ret.push_back( bind(&GaussianOrthogonalPolynomial::weightedValue, GaussLegendrePolynomial(), i, _1)); break; case Chebyshev: ret.push_back( bind(&GaussianOrthogonalPolynomial::weightedValue, GaussChebyshevPolynomial(), i, _1)); break; case Chebyshev2nd: ret.push_back( bind(&GaussianOrthogonalPolynomial::weightedValue, GaussChebyshev2ndPolynomial(), i, _1)); break; default: QL_FAIL("unknown regression type"); } } return ret; }
std::ostream& operator<<(std::ostream& out, SwapIndex::FixingType t) { switch (t) { case SwapIndex::IsdaFixA: return out << "IsdaFixA"; case SwapIndex::IsdaFixB: return out << "IsdaFixB"; case SwapIndex::IfrFix: return out << "IfrFix"; case SwapIndex::IsdaFixAm: return out << "IsdaFixAm"; case SwapIndex::IsdaFixPm: return out << "IsdaFixPm"; default: QL_FAIL("unknown SwapIndex::FixingType(" << QuantLib::Integer(t) << ")"); } }
boost::shared_ptr<DayCounter::Impl> ActualActual::implementation(ActualActual::Convention c) { switch (c) { case ISMA: case Bond: return boost::shared_ptr<DayCounter::Impl>(new ISMA_Impl); case ISDA: case Historical: case Actual365: return boost::shared_ptr<DayCounter::Impl>(new ISDA_Impl); case AFB: case Euro: return boost::shared_ptr<DayCounter::Impl>(new AFB_Impl); default: QL_FAIL("unknown act/act convention"); } }
SouthKorea::SouthKorea(Market market) { // all calendar instances share the same implementation instance static boost::shared_ptr<Calendar::Impl> settlementImpl( new SouthKorea::SettlementImpl); static boost::shared_ptr<Calendar::Impl> krxImpl( new SouthKorea::KrxImpl); switch (market) { case Settlement: impl_ = settlementImpl; break; case KRX: impl_ = krxImpl; break; default: QL_FAIL("unknown market"); } }
Real FilonIntegral::integrate(const ext::function<Real (Real)>& f, Real a, Real b) const { const Real h = (b-a)/(2*n_); Array x(2*n_+1, a, h); const Real theta = t_*h; const Real theta2 = theta*theta; const Real theta3 = theta2*theta; const Real alpha = 1/theta + std::sin(2*theta)/(2*theta2) - 2*square<Real>()(std::sin(theta))/theta3; const Real beta = 2*( (1+square<Real>()(std::cos(theta)))/theta2 - std::sin(2*theta)/theta3); const Real gamma = 4*(std::sin(theta)/theta3 - std::cos(theta)/theta2); Array v(x.size()); std::transform(x.begin(), x.end(), v.begin(), f); ext::function<Real(Real)> f1, f2; switch(type_) { case Cosine: f1 = static_cast<Real(*)(Real)>(std::sin); f2 = static_cast<Real(*)(Real)>(std::cos); break; case Sine: f1 = static_cast<Real(*)(Real)>(std::cos); f2 = static_cast<Real(*)(Real)>(std::sin); break; default: QL_FAIL("unknown integration type"); } Real c_2n_1 = 0.0; Real c_2n = v[0]*f2(t_*a) - 0.5*(v[2*n_]*f2(t_*b) + v[0]*f2(t_*a)); for (Size i=1; i <= n_; ++i) { c_2n += v[2*i] *f2(t_*x[2*i]); c_2n_1 += v[2*i-1]*f2(t_*x[2*i-1]); } return h*(alpha*(v[2*n_]*f1(t_*x[2*n_]) - v[0]*f1(t_*x[0])) *((type_ == Cosine) ? 1.0 : -1.0) + beta*c_2n + gamma*c_2n_1); }
boost::shared_ptr<QuantLib::OperatorND> qlOperatorFactory::operatorND(const boost::shared_ptr<FpmlSerialized::OperatorND>& xml_serial) { boost::shared_ptr<QuantLib::OperatorND> ql_oper; std::string operNDType = xml_serial->getType()->SValue(); if ( operNDType == "additionOperND" ) { const boost::shared_ptr<FpmlSerialized::AdditionOperND>& xml_operND = xml_serial->getAdditionOperND(); ql_oper = this->additionOperND(xml_operND); } else if ( operNDType == "multipleOperND" ) { const boost::shared_ptr<FpmlSerialized::MultipleOperND>& xml_operND = xml_serial->getMultipleOperND(); ql_oper = this->multipleOperND(xml_operND); } else if ( operNDType == "maximumOperND" ) { const boost::shared_ptr<FpmlSerialized::MaximumOperND>& xml_operND = xml_serial->getMaximumOperND(); ql_oper = this->maximumOperND(xml_operND); } else if ( operNDType == "divisionOperND" ) { const boost::shared_ptr<FpmlSerialized::DivisionOperND>& xml_operND = xml_serial->getDivisionOperND(); ql_oper = this->divisionOperND(xml_operND); } else if ( operNDType == "identityOperND" ) { ql_oper = this->identityOperND(); } else { QL_FAIL("unknown operNDType : " << operNDType); } return ql_oper; }
QuantLib::BusinessDayConvention businessDayConvention(const std::string& typeStr) { QuantLib::BusinessDayConvention bdc; std::string upperStr = boost::to_upper_copy(typeStr); if(upperStr=="FOLLOWING") { bdc = QuantLib::Following; } else { QL_FAIL("unknown type calendar string"); } return bdc; }
/*! The constructor takes as inputs - rateTimes the libor grid points - mode the parametrization mode, see below which are available - parameters generic parameters describing the parameterization, see below for their meaning for each mode The following values for mode are possible and the following parameters must be given: - mode=0: N (N=number of libors) parameters must be given. The first parameter is the skew for the next libor not yet expired, the second one for the libor after that and so on. - mode=1: 2 Parameters \f$ (b_0, lambda) \f$ must be given. The skew for the ith not expired libor (i starting with 0) is \f$ 1.0 - b_0 e^{-\lambda i}\f$ */ PiecewiseConstantBeta(std::vector<Time>& rateTimes, int mode, std::vector<Real>& parameters ) : rateTimes_(rateTimes), N_(rateTimes.size()-1), parameters_(parameters), mode_(mode) { // set number of parameters switch(mode_) { case 0: P_=N_; break; case 1: P_=2; break; default: QL_FAIL("mode " << mode_ << " not supported."); } // initialize beta beta_=std::vector<double>(N_,0.0); setParameters(); }
TridiagonalOperator::TridiagonalOperator(Size size) { if (size>=2) { n_ = size; diagonal_ = Array(size); lowerDiagonal_ = Array(size-1); upperDiagonal_ = Array(size-1); temp_ = Array(size); } else if (size==0) { n_ = 0; diagonal_ = Array(0); lowerDiagonal_ = Array(0); upperDiagonal_ = Array(0); temp_ = Array(0); } else { QL_FAIL("invalid size (" << size << ") for tridiagonal operator " "(must be null or >= 2)"); } }
Real GaussJacobiPolynomial::beta(Size i) const { Real num = 4.0*i*(i+alpha_)*(i+beta_)*(i+alpha_+beta_); Real denom = (2.0*i+alpha_+beta_)*(2.0*i+alpha_+beta_) * ((2.0*i+alpha_+beta_)*(2.0*i+alpha_+beta_)-1); if (!denom) { if (num != 0.0) { QL_FAIL("can't compute b_k for jacobi integration\n"); } else { // l'Hospital num = 4.0*i*(i+beta_)* (2.0*i+2*alpha_+beta_); denom= 2.0*(2.0*i+alpha_+beta_); denom*=denom-1; QL_ASSERT(denom, "can't compute b_k for jacobi integration\n"); } } return num / denom; }
Date ComplexTimeFunctionVariableValue::calculateLastIndexFixing() { if(!(this->variableBindingFlag_)) QL_FAIL("variable is not bind"); for(Size i=0;i<addedVariableValues_.size();++i) { const Date& roopDate = addedVariableValues_[i]->calculateLastIndexFixing(); if( lastFixingDate_ < roopDate ) { lastFixingDate_ = roopDate; } } return lastFixingDate_; }
Brazil::Brazil(Brazil::Market market) { // all calendar instances on the same market share the same // implementation instance static boost::shared_ptr<Calendar::Impl> settlementImpl( new Brazil::SettlementImpl); static boost::shared_ptr<Calendar::Impl> exchangeImpl( new Brazil::ExchangeImpl); switch (market) { case Settlement: impl_ = settlementImpl; break; case Exchange: impl_ = exchangeImpl; break; default: QL_FAIL("unknown market"); } }
boost::shared_ptr<Fdm1dMesher> FdmVPPStepConditionFactory::stateMesher() const { Size nStates; switch (type_) { case Vanilla: nStates = 2*args_.tMinUp + args_.tMinDown; break; case StartLimit: nStates = FdmVPPStartLimitStepCondition::nStates( args_.tMinUp,args_.tMinDown, args_.nStarts); break; default: QL_FAIL("vpp type is not supported"); } return boost::shared_ptr<Fdm1dMesher>( new Uniform1dMesher(0.0, 1.0, nStates)); }
DateTimeList::DateTimeList(TiXmlNode* xmlNode) : ISerialized(xmlNode) { #ifdef ConsolePrint std::string initialtap_ = FileManager::instance().tap_; FileManager::instance().tap_.append(" "); #endif //dateTimeNode ---------------------------------------------------------------------------------------------------------------------- TiXmlElement* dateTimeNode = xmlNode->FirstChildElement("dateTime"); if(dateTimeNode){dateTimeIsNull_ = false;} else{dateTimeIsNull_ = true;} if(dateTimeNode) { for(dateTimeNode; dateTimeNode; dateTimeNode = dateTimeNode->NextSiblingElement("dateTime")){ #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- dateTimeNode , address : " << dateTimeNode << std::endl; #endif if(dateTimeNode->Attribute("href") || dateTimeNode->Attribute("id")) { if(dateTimeNode->Attribute("id")) { dateTimeIDRef_ = dateTimeNode->Attribute("id"); dateTime_.push_back(boost::shared_ptr<XsdTypeDateTime>(new XsdTypeDateTime(dateTimeNode))); dateTime_.back()->setID(dateTimeIDRef_); IDManager::instance().setID(dateTimeIDRef_, dateTime_.back()); } else if(dateTimeNode->Attribute("href")) { dateTimeIDRef_ = dateTimeNode->Attribute("href");} else { QL_FAIL("id or href error"); } } else { dateTime_.push_back(boost::shared_ptr<XsdTypeDateTime>(new XsdTypeDateTime(dateTimeNode)));} } } else { #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- dateTimeNode , address : " << dateTimeNode << std::endl; #endif } #ifdef ConsolePrint FileManager::instance().tap_ = initialtap_; #endif }
ReferencePool::ReferencePool(TiXmlNode* xmlNode) : ISerialized(xmlNode) { #ifdef ConsolePrint std::string initialtap_ = FileManager::instance().tap_; FileManager::instance().tap_.append(" "); #endif //referencePoolItemNode ---------------------------------------------------------------------------------------------------------------------- TiXmlElement* referencePoolItemNode = xmlNode->FirstChildElement("referencePoolItem"); if(referencePoolItemNode){referencePoolItemIsNull_ = false;} else{referencePoolItemIsNull_ = true;} if(referencePoolItemNode) { for(referencePoolItemNode; referencePoolItemNode; referencePoolItemNode = referencePoolItemNode->NextSiblingElement("referencePoolItem")){ #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- referencePoolItemNode , address : " << referencePoolItemNode << std::endl; #endif if(referencePoolItemNode->Attribute("href") || referencePoolItemNode->Attribute("id")) { if(referencePoolItemNode->Attribute("id")) { referencePoolItemIDRef_ = referencePoolItemNode->Attribute("id"); referencePoolItem_.push_back(boost::shared_ptr<ReferencePoolItem>(new ReferencePoolItem(referencePoolItemNode))); referencePoolItem_.back()->setID(referencePoolItemIDRef_); IDManager::instance().setID(referencePoolItemIDRef_, referencePoolItem_.back()); } else if(referencePoolItemNode->Attribute("href")) { referencePoolItemIDRef_ = referencePoolItemNode->Attribute("href");} else { QL_FAIL("id or href error"); } } else { referencePoolItem_.push_back(boost::shared_ptr<ReferencePoolItem>(new ReferencePoolItem(referencePoolItemNode)));} } } else { #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- referencePoolItemNode , address : " << referencePoolItemNode << std::endl; #endif } #ifdef ConsolePrint FileManager::instance().tap_ = initialtap_; #endif }
BaseIndexes::BaseIndexes(TiXmlNode* xmlNode) : ISerialized(xmlNode) { #ifdef ConsolePrint std::string initialtap_ = FileManager::instance().tap_; FileManager::instance().tap_.append(" "); #endif //underlyingIndexNode ---------------------------------------------------------------------------------------------------------------------- TiXmlElement* underlyingIndexNode = xmlNode->FirstChildElement("underlyingIndex"); if(underlyingIndexNode){underlyingIndexIsNull_ = false;} else{underlyingIndexIsNull_ = true;} if(underlyingIndexNode) { for(underlyingIndexNode; underlyingIndexNode; underlyingIndexNode = underlyingIndexNode->NextSiblingElement("underlyingIndex")){ #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- underlyingIndexNode , address : " << underlyingIndexNode << std::endl; #endif if(underlyingIndexNode->Attribute("href") || underlyingIndexNode->Attribute("id")) { if(underlyingIndexNode->Attribute("id")) { underlyingIndexIDRef_ = underlyingIndexNode->Attribute("id"); underlyingIndex_.push_back(boost::shared_ptr<UnderlyingIndex>(new UnderlyingIndex(underlyingIndexNode))); underlyingIndex_.back()->setID(underlyingIndexIDRef_); IDManager::instance().setID(underlyingIndexIDRef_, underlyingIndex_.back()); } else if(underlyingIndexNode->Attribute("href")) { underlyingIndexIDRef_ = underlyingIndexNode->Attribute("href");} else { QL_FAIL("id or href error"); } } else { underlyingIndex_.push_back(boost::shared_ptr<UnderlyingIndex>(new UnderlyingIndex(underlyingIndexNode)));} } } else { #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- underlyingIndexNode , address : " << underlyingIndexNode << std::endl; #endif } #ifdef ConsolePrint FileManager::instance().tap_ = initialtap_; #endif }
StreetAddress::StreetAddress(TiXmlNode* xmlNode) : ISerialized(xmlNode) { #ifdef ConsolePrint std::string initialtap_ = FileManager::instance().tap_; FileManager::instance().tap_.append(" "); #endif //streetLineNode ---------------------------------------------------------------------------------------------------------------------- TiXmlElement* streetLineNode = xmlNode->FirstChildElement("streetLine"); if(streetLineNode){streetLineIsNull_ = false;} else{streetLineIsNull_ = true;} if(streetLineNode) { for(streetLineNode; streetLineNode; streetLineNode = streetLineNode->NextSiblingElement("streetLine")){ #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- streetLineNode , address : " << streetLineNode << std::endl; #endif if(streetLineNode->Attribute("href") || streetLineNode->Attribute("id")) { if(streetLineNode->Attribute("id")) { streetLineIDRef_ = streetLineNode->Attribute("id"); streetLine_.push_back(boost::shared_ptr<XsdTypeString>(new XsdTypeString(streetLineNode))); streetLine_.back()->setID(streetLineIDRef_); IDManager::instance().setID(streetLineIDRef_, streetLine_.back()); } else if(streetLineNode->Attribute("href")) { streetLineIDRef_ = streetLineNode->Attribute("href");} else { QL_FAIL("id or href error"); } } else { streetLine_.push_back(boost::shared_ptr<XsdTypeString>(new XsdTypeString(streetLineNode)));} } } else { #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- streetLineNode , address : " << streetLineNode << std::endl; #endif } #ifdef ConsolePrint FileManager::instance().tap_ = initialtap_; #endif }
EventSchedule::EventSchedule(TiXmlNode* xmlNode) : ISerialized(xmlNode) { #ifdef ConsolePrint std::string initialtap_ = FileManager::instance().tap_; FileManager::instance().tap_.append(" "); #endif //eventCheckNode ---------------------------------------------------------------------------------------------------------------------- TiXmlElement* eventCheckNode = xmlNode->FirstChildElement("eventCheck"); if(eventCheckNode){eventCheckIsNull_ = false;} else{eventCheckIsNull_ = true;} if(eventCheckNode) { for(eventCheckNode; eventCheckNode; eventCheckNode = eventCheckNode->NextSiblingElement("eventCheck")){ #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- eventCheckNode , address : " << eventCheckNode << std::endl; #endif if(eventCheckNode->Attribute("href") || eventCheckNode->Attribute("id")) { if(eventCheckNode->Attribute("id")) { eventCheckIDRef_ = eventCheckNode->Attribute("id"); eventCheck_.push_back(boost::shared_ptr<EventCheck>(new EventCheck(eventCheckNode))); eventCheck_.back()->setID(eventCheckIDRef_); IDManager::instance().setID(eventCheckIDRef_, eventCheck_.back()); } else if(eventCheckNode->Attribute("href")) { eventCheckIDRef_ = eventCheckNode->Attribute("href");} else { QL_FAIL("id or href error"); } } else { eventCheck_.push_back(boost::shared_ptr<EventCheck>(new EventCheck(eventCheckNode)));} } } else { #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- eventCheckNode , address : " << eventCheckNode << std::endl; #endif } #ifdef ConsolePrint FileManager::instance().tap_ = initialtap_; #endif }
VarianceSwap::VarianceSwap(TiXmlNode* xmlNode) : NettedSwapBase(xmlNode) { #ifdef ConsolePrint std::string initialtap_ = FileManager::instance().tap_; FileManager::instance().tap_.append(" "); #endif //varianceLegNode ---------------------------------------------------------------------------------------------------------------------- TiXmlElement* varianceLegNode = xmlNode->FirstChildElement("varianceLeg"); if(varianceLegNode){varianceLegIsNull_ = false;} else{varianceLegIsNull_ = true;} if(varianceLegNode) { for(varianceLegNode; varianceLegNode; varianceLegNode = varianceLegNode->NextSiblingElement("varianceLeg")){ #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- varianceLegNode , address : " << varianceLegNode << std::endl; #endif if(varianceLegNode->Attribute("href") || varianceLegNode->Attribute("id")) { if(varianceLegNode->Attribute("id")) { varianceLegIDRef_ = varianceLegNode->Attribute("id"); varianceLeg_.push_back(boost::shared_ptr<VarianceLeg>(new VarianceLeg(varianceLegNode))); varianceLeg_.back()->setID(varianceLegIDRef_); IDManager::instance().setID(varianceLegIDRef_, varianceLeg_.back()); } else if(varianceLegNode->Attribute("href")) { varianceLegIDRef_ = varianceLegNode->Attribute("href");} else { QL_FAIL("id or href error"); } } else { varianceLeg_.push_back(boost::shared_ptr<VarianceLeg>(new VarianceLeg(varianceLegNode)));} } } else { #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- varianceLegNode , address : " << varianceLegNode << std::endl; #endif } #ifdef ConsolePrint FileManager::instance().tap_ = initialtap_; #endif }
Allocations::Allocations(TiXmlNode* xmlNode) : ISerialized(xmlNode) { #ifdef ConsolePrint std::string initialtap_ = FileManager::instance().tap_; FileManager::instance().tap_.append(" "); #endif //allocationNode ---------------------------------------------------------------------------------------------------------------------- TiXmlElement* allocationNode = xmlNode->FirstChildElement("allocation"); if(allocationNode){allocationIsNull_ = false;} else{allocationIsNull_ = true;} if(allocationNode) { for(allocationNode; allocationNode; allocationNode = allocationNode->NextSiblingElement("allocation")){ #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- allocationNode , address : " << allocationNode << std::endl; #endif if(allocationNode->Attribute("href") || allocationNode->Attribute("id")) { if(allocationNode->Attribute("id")) { allocationIDRef_ = allocationNode->Attribute("id"); allocation_.push_back(boost::shared_ptr<Allocation>(new Allocation(allocationNode))); allocation_.back()->setID(allocationIDRef_); IDManager::instance().setID(allocationIDRef_, allocation_.back()); } else if(allocationNode->Attribute("href")) { allocationIDRef_ = allocationNode->Attribute("href");} else { QL_FAIL("id or href error"); } } else { allocation_.push_back(boost::shared_ptr<Allocation>(new Allocation(allocationNode)));} } } else { #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- allocationNode , address : " << allocationNode << std::endl; #endif } #ifdef ConsolePrint FileManager::instance().tap_ = initialtap_; #endif }
ExtendibleProvisionAdjustedDates::ExtendibleProvisionAdjustedDates(TiXmlNode* xmlNode) : ISerialized(xmlNode) { #ifdef ConsolePrint std::string initialtap_ = FileManager::instance().tap_; FileManager::instance().tap_.append(" "); #endif //extensionEventNode ---------------------------------------------------------------------------------------------------------------------- TiXmlElement* extensionEventNode = xmlNode->FirstChildElement("extensionEvent"); if(extensionEventNode){extensionEventIsNull_ = false;} else{extensionEventIsNull_ = true;} if(extensionEventNode) { for(extensionEventNode; extensionEventNode; extensionEventNode = extensionEventNode->NextSiblingElement("extensionEvent")){ #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- extensionEventNode , address : " << extensionEventNode << std::endl; #endif if(extensionEventNode->Attribute("href") || extensionEventNode->Attribute("id")) { if(extensionEventNode->Attribute("id")) { extensionEventIDRef_ = extensionEventNode->Attribute("id"); extensionEvent_.push_back(boost::shared_ptr<ExtensionEvent>(new ExtensionEvent(extensionEventNode))); extensionEvent_.back()->setID(extensionEventIDRef_); IDManager::instance().setID(extensionEventIDRef_, extensionEvent_.back()); } else if(extensionEventNode->Attribute("href")) { extensionEventIDRef_ = extensionEventNode->Attribute("href");} else { QL_FAIL("id or href error"); } } else { extensionEvent_.push_back(boost::shared_ptr<ExtensionEvent>(new ExtensionEvent(extensionEventNode)));} } } else { #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- extensionEventNode , address : " << extensionEventNode << std::endl; #endif } #ifdef ConsolePrint FileManager::instance().tap_ = initialtap_; #endif }
PartyTradeIdentifiers::PartyTradeIdentifiers(TiXmlNode* xmlNode) : ISerialized(xmlNode) { #ifdef ConsolePrint std::string initialtap_ = FileManager::instance().tap_; FileManager::instance().tap_.append(" "); #endif //partyTradeIdentifierNode ---------------------------------------------------------------------------------------------------------------------- TiXmlElement* partyTradeIdentifierNode = xmlNode->FirstChildElement("partyTradeIdentifier"); if(partyTradeIdentifierNode){partyTradeIdentifierIsNull_ = false;} else{partyTradeIdentifierIsNull_ = true;} if(partyTradeIdentifierNode) { for(partyTradeIdentifierNode; partyTradeIdentifierNode; partyTradeIdentifierNode = partyTradeIdentifierNode->NextSiblingElement("partyTradeIdentifier")){ #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- partyTradeIdentifierNode , address : " << partyTradeIdentifierNode << std::endl; #endif if(partyTradeIdentifierNode->Attribute("href") || partyTradeIdentifierNode->Attribute("id")) { if(partyTradeIdentifierNode->Attribute("id")) { partyTradeIdentifierIDRef_ = partyTradeIdentifierNode->Attribute("id"); partyTradeIdentifier_.push_back(boost::shared_ptr<PartyTradeIdentifier>(new PartyTradeIdentifier(partyTradeIdentifierNode))); partyTradeIdentifier_.back()->setID(partyTradeIdentifierIDRef_); IDManager::instance().setID(partyTradeIdentifierIDRef_, partyTradeIdentifier_.back()); } else if(partyTradeIdentifierNode->Attribute("href")) { partyTradeIdentifierIDRef_ = partyTradeIdentifierNode->Attribute("href");} else { QL_FAIL("id or href error"); } } else { partyTradeIdentifier_.push_back(boost::shared_ptr<PartyTradeIdentifier>(new PartyTradeIdentifier(partyTradeIdentifierNode)));} } } else { #ifdef ConsolePrint FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- partyTradeIdentifierNode , address : " << partyTradeIdentifierNode << std::endl; #endif } #ifdef ConsolePrint FileManager::instance().tap_ = initialtap_; #endif }