Exemplo n.º 1
0
 public virtual void Build()
 {
     _calendar       = Parsers.ParseCalendar(_strCalendar);
     _convention     = Parsers.ParseBusinessDayConvention(_strConvention);
     _eom            = Parsers.ParseBool(_strEom);
     _dayCounter     = Parsers.ParseDayCounter(_strDayCounter);
     _settlementDays = Parsers.ParseInteger(_strSettlementDays);
 }
Exemplo n.º 2
0
 public virtual void Build()
 {
     _spotDays        = Parsers.ParseInteger(_strSpotDays);
     _sourceCurrency  = Parsers.ParseCurrency(_strSourceCurrency);
     _targetCurrency  = Parsers.ParseCurrency(_strTargetCurrency);
     _pointsFactor    = Parsers.ParseDouble(_strPointsFactor);
     _advanceCalendar = _strAdvanceCalendar == "" ? new NullCalendar() : Parsers.ParseCalendar(_strAdvanceCalendar);
     _spotRelative    = _strSpotRelative == "" ? true : Parsers.ParseBool(_strSpotRelative);
 }
Exemplo n.º 3
0
        public virtual void Build()
        {
            _dayCounter           = Parsers.ParseDayCounter(_strDayCounter);
            _compounding          = _strCompounding == string.Empty ? QLNet.Compounding.Continuous : Parsers.ParseCompounding(_strCompounding);
            _compoundingFrequency = _strCompoundingFrequency == string.Empty ? Frequency.Annual : Parsers.ParseFrequency(_strCompoundingFrequency);

            if (_tenorBased)
            {
                _tenorCalendar  = Parsers.ParseCalendar(_strTenorCalendar);
                _spotLag        = Convert.ToInt32(_strSpotLag);
                _spotCalendar   = Parsers.ParseCalendar(_strSpotCalendar);
                _rollConvention = Parsers.ParseBusinessDayConvention(_strRollConvention);
                _eom            = Parsers.ParseBool(_strEom);
            }
        }
Exemplo n.º 4
0
        public override void FromXML(XmlNode node)
        {
            CheckNode(node, "FXVolatility");

            _curveID          = GetChildValue(node, "CurveId", true);
            _curveDescription = GetChildValue(node, "CurveDescription", true);
            string dim = GetChildValue(node, "Dimension", true);
            string cal = GetChildValue(node, "Calendar");

            if (cal == "")
            {
                cal = "TARGET";
            }

            _calendar = Parsers.ParseCalendar(cal);

            string dc = GetChildValue(node, "DayCounter");

            if (dc == "")
            {
                dc = "A365";
            }

            _dayCounter = Parsers.ParseDayCounter(dc);

            if (dim == "ATM")
            {
                _dimension = Dimension.ATM;
            }
            else if (dim == "Smile")
            {
                _dimension = Dimension.Smile;
            }
            else
            {
                Utils.QL_FAIL("Dimension " + dim + " not supported yet");
            }
            _expiries = GetChildrenValuesAsPeriods(node, "Expiries", true);

            if (_dimension == Dimension.Smile)
            {
                _fxSpotID = GetChildValue(node, "FXSpotID", true);
                _fxForeignYieldCurveID  = GetChildValue(node, "FXForeignCurveID", true);
                _fxDomesticYieldCurveID = GetChildValue(node, "FXDomesticCurveID", true);
            }
        }
Exemplo n.º 5
0
        public virtual void Build()
        {
            _fixedCalendar   = Parsers.ParseCalendar(_strFixedCalendar);
            _fixedFrequency  = Parsers.ParseFrequency(_strFixedFrequency);
            _fixedConvention = Parsers.ParseBusinessDayConvention(_strFixedConvention);
            _fixedDayCounter = Parsers.ParseDayCounter(_strFixedDayCounter);
            _index           = Parsers.ParseIborIndex(_strIndex);

            if (_hasSubPeriod)
            {
                _floatFrequency = Parsers.ParseFrequency(_strFloatFrequency);
                //_subPeriodsCouponType = Parsers.ParseSubPeriodsCouponType(_strSubPeriodsCouponType);
            }
            else
            {
                _floatFrequency = Frequency.NoFrequency;
                //_subPeriodsCouponType = QuantExt::SubPeriodsCoupon::Compounding;
            }
        }
Exemplo n.º 6
0
        public override void FromXML(XmlNode node)
        {
            CheckNode(node, "SwaptionVolatility");

            _curveID          = GetChildValue(node, "CurveId", true);
            _curveDescription = GetChildValue(node, "CurveDescription", true);

            string dim = GetChildValue(node, "Dimension", true);

            if (dim == "ATM")
            {
                _dimension = Dimension.ATM;
            }
            else if (dim == "Smile")
            {
                _dimension = Dimension.Smile;
            }
            else
            {
                Utils.QL_FAIL("Dimension " + dim + " not recognized");
            }

            string volType = GetChildValue(node, "VolatilityType", true);

            if (volType == "Normal")
            {
                _volatilityType = VolatilityType.Normal;
            }
            else if (volType == "Lognormal")
            {
                _volatilityType = VolatilityType.Lognormal;
            }
            else if (volType == "ShiftedLognormal")
            {
                _volatilityType = VolatilityType.ShiftedLognormal;
            }
            else
            {
                Utils.QL_FAIL("Volatility type " + volType + " not recognized");
            }

            string extr = GetChildValue(node, "Extrapolation", true);

            _extrapolate       = true;
            _flatExtrapolation = true;
            if (extr == "Linear")
            {
                _flatExtrapolation = false;
            }
            else if (extr == "Flat")
            {
                _flatExtrapolation = true;
            }
            else if (extr == "None")
            {
                _extrapolate = false;
            }
            else
            {
                Utils.QL_FAIL("Extrapolation " + extr + " not recognized");
            }

            _optionTenors = GetChildrenValuesAsPeriods(node, "OptionTenors", true);
            _swapTenors   = GetChildrenValuesAsPeriods(node, "SwapTenors", true);

            string cal = GetChildValue(node, "Calendar", true);

            _calendar = Parsers.ParseCalendar(cal);

            string dc = GetChildValue(node, "DayCounter", true);

            _dayCounter = Parsers.ParseDayCounter(dc);

            string bdc = GetChildValue(node, "BusinessDayConvention", true);

            _businessDayConvention = Parsers.ParseBusinessDayConvention(bdc);

            _shortSwapIndexBase = GetChildValue(node, "ShortSwapIndexBase", true);
            _swapIndexBase      = GetChildValue(node, "SwapIndexBase", true);

            // optional smile stuff
            _smileOptionTenors = GetChildrenValuesAsPeriods(node, "SmileOptionTenors", false);
            _smileSwapTenors   = GetChildrenValuesAsPeriods(node, "SmileSwapTenors", false);
            _smileSpreads      = GetChildrenValuesAsDoublesCompact(node, "SmileSpreads", false);
        }