Пример #1
0
 Libor::Libor(const std::string& familyName,
              const Period& tenor,
              Natural settlementDays,
              const Currency& currency,
              const Calendar& financialCenterCalendar,
              const DayCounter& dayCounter,
              const Handle<YieldTermStructure>& h)
 : IborIndex(familyName, tenor, settlementDays, currency,
             // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :
             // UnitedKingdom::Exchange is the fixing calendar for
             // a) all currencies but EUR
             // b) all indexes but o/n and s/n
             UnitedKingdom(UnitedKingdom::Exchange),
             liborConvention(tenor), liborEOM(tenor),
             dayCounter, h),
   financialCenterCalendar_(financialCenterCalendar),
   jointCalendar_(JointCalendar(UnitedKingdom(UnitedKingdom::Exchange),
                                financialCenterCalendar,
                                JoinHolidays)) {
     QL_REQUIRE(this->tenor().units()!=Days,
                "for daily tenors (" << this->tenor() <<
                ") dedicated DailyTenor constructor must be used");
     QL_REQUIRE(currency!=EURCurrency(),
                "for EUR Libor dedicated EurLibor constructor must be used");
 }
Пример #2
0
 DailyTenorGBPLibor(Natural settlementDays,
                    const Handle<YieldTermStructure>& h =
                             Handle<YieldTermStructure>())
 : DailyTenorLibor("GBPLibor", settlementDays,
                   GBPCurrency(),
                   UnitedKingdom(UnitedKingdom::Exchange),
                   Actual365Fixed(), h) {}
Пример #3
0
 GBPLibor(const Period& tenor,
          const Handle<YieldTermStructure>& h =
                             Handle<YieldTermStructure>())
 : Libor("GBPLibor", tenor,
         0,
         GBPCurrency(),
         UnitedKingdom(UnitedKingdom::Exchange),
         Actual365Fixed(), h) {}
Пример #4
0
 THBFIX(const Period& tenor,
        const Handle<YieldTermStructure>& h =
                             Handle<YieldTermStructure>())
 : IborIndex("THBFIX", tenor,
             2,
             THBCurrency(),
             JointCalendar(UnitedKingdom(UnitedKingdom::Exchange),
                           JointCalendar(UnitedStates(UnitedStates::LiborImpact),
                                         Thailand())),
             ModifiedFollowing, true,
             Actual365Fixed(), h) {}
Пример #5
0
 GbpLiborSwapIsdaFix::GbpLiborSwapIsdaFix(
                         const Period& tenor,
                         const Handle<YieldTermStructure>& h)
 : SwapIndex("GbpLiborSwapIsdaFix", // familyName
             tenor,
             0, // settlementDays
             GBPCurrency(),
             UnitedKingdom(UnitedKingdom::Exchange),
             tenor > 1*Years ? // fixedLegTenor
                 6*Months : 1*Years,
             ModifiedFollowing, // fixedLegConvention
             Actual365Fixed(), // fixedLegDaycounter
             tenor > 1*Years ?
                 shared_ptr<IborIndex>(new GBPLibor(6*Months, h)) :
                 shared_ptr<IborIndex>(new GBPLibor(3*Months, h))) {}
Пример #6
0
 DailyTenorLibor::DailyTenorLibor(
              const std::string& familyName,
              Natural settlementDays,
              const Currency& currency,
              const Calendar& financialCenterCalendar,
              const DayCounter& dayCounter,
              const Handle<YieldTermStructure>& h)
 : IborIndex(familyName, 1*Days, settlementDays, currency,
             // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :
             // no o/n or s/n fixings (as the case may be) will take place
             // when the principal centre of the currency concerned is
             // closed but London is open on the fixing day.
             JointCalendar(UnitedKingdom(UnitedKingdom::Exchange),
                           financialCenterCalendar,
                           JoinHolidays),
             liborConvention(1*Days), liborEOM(1*Days),
             dayCounter, h) {
     QL_REQUIRE(currency!=EURCurrency(),
                "for EUR Libor dedicated EurLibor constructor must be used");
 }
Пример #7
0
 Sonia::Sonia(const Handle<YieldTermStructure>& h)
 : OvernightIndex("Sonia", 0, GBPCurrency(),
                  UnitedKingdom(UnitedKingdom::Exchange),
                  Actual365Fixed(), h) {}
DLLEXPORT char *createContractForwardAsian(char *objectID,
                                            OPER *startOfAveraging,
                                            OPER *endOfAveraging,
                                            OPER *settlement,
                                            double strike,
                                            double volume,
                                            char* buySell,
                                            bool *permanent) 
{

    boost::shared_ptr<ObjectHandler::FunctionCall> functionCall;
    static char ret[XL_MAX_STR_LEN];

    try 
   {

        functionCall = boost::shared_ptr<ObjectHandler::FunctionCall>
            (new ObjectHandler::FunctionCall("createContractForwardAsian"));

        sjd::BuySell bs;
      if (!sjdObjects::convertBuySellInput(buySell, bs))
      {
         ObjectHandler::stringToChar("(B)uy or (S)ell not set correctly", ret);
         return ret;
      }

        // convert input datatypes to QuantLib datatypes

        QuantLib::Date StartDateLib = ObjectHandler::convert2<QuantLib::Date>(
            ObjectHandler::ConvertOper(*startOfAveraging), "StartDate");

        QuantLib::Date EndDateLib = ObjectHandler::convert2<QuantLib::Date>(
            ObjectHandler::ConvertOper(*endOfAveraging), "EndDate");

        if (EndDateLib <= StartDateLib)
      {
         ObjectHandler::stringToChar("Start of averaging > end of the averaging!", ret);
         return ret;
      }

        QuantLib::Date SellementDateLib = ObjectHandler::convert2<QuantLib::Date>(
            ObjectHandler::ConvertOper(*settlement), "SettlementDate");

        if (SellementDateLib < EndDateLib)
      {
         ObjectHandler::stringToChar("Settlement < end of averaging!", ret);
         return ret;
      }

        // Strip the Excel cell update counter suffix from Object IDs
        
        std::string ObjectIdStrip = ObjectHandler::CallingRange::getStub(objectID);

        // Construct the Value Object
        boost::shared_ptr<ObjectHandler::ValueObject> valueObject(
            new sjdObjects::ValueObjects::GenericUnimplementedValueObject(ObjectIdStrip, *permanent));
        
        Calendar calendar = UnitedKingdom();
        boost::shared_ptr<ObjectHandler::Object> object(
            new sjdObjects::AsianForwardContract(valueObject,
                                          calendar,
                                          StartDateLib,
                                          EndDateLib,
                                          SellementDateLib, 
                                          strike, 
                                          volume,
                                          bs,
                                          *permanent));


        // Store the Object in the Repository

        std::string returnValue =
            ObjectHandler::RepositoryXL::instance().storeObject(ObjectIdStrip, object, true);

        ObjectHandler::stringToChar(returnValue, ret);
        return ret;

    } 
   SJD_XLL_CATCH_STRING()
}