Ejemplo n.º 1
0
        /// <summary>
        /// Builds this instance.
        /// </summary>
        public override void Build(ILogger logger, ICoreCache cache, string nameSpace,
                                   IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar)
        {
            PriceableEquityAssets = PriceableAssetFactory.CreatePriceableEquityAssets(logger, cache, nameSpace,
                                                                                      GetEquityCurveValuation().baseDate.Value, GetEquityCurveValuation().spotRate, fixingCalendar, rollCalendar);
            TermCurve termCurve = ((FxCurveValuation)PricingStructureValuation).fxForwardCurve;

            termCurve.point = EquityBootstrapper.Bootstrap(PriceableEquityAssets, GetEquityCurveValuation().baseDate.Value, termCurve.extrapolationPermitted,
                                                           termCurve.interpolationMethod);
            SetFpmlData(new Pair <PricingStructure, PricingStructureValuation>(PricingStructure, PricingStructureValuation));
            SetInterpolator(GetEquityCurveValuation().baseDate.Value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RateCurve"/> class.
        /// This constructor is used to clone perturbed copies of a base curve.
        /// </summary>
        /// <param name="priceableEquityAssets">The priceable equity Assets.</param>
        /// <param name="pricingStructureAlgorithmsHolder">The pricingStructureAlgorithmsHolder.</param>
        /// <param name="curveProperties">The Curve Properties.</param>
        public EquityCurve(NamedValueSet curveProperties, List <IPriceableEquityAssetController> priceableEquityAssets,
                           PricingStructureAlgorithmsHolder pricingStructureAlgorithmsHolder)
            : this(curveProperties, pricingStructureAlgorithmsHolder)
        {
            var curveId   = GetEquityCurveId();
            var termCurve = SetConfigurationData();

            PriceableEquityAssets = priceableEquityAssets;
            termCurve.point       = EquityBootstrapper.Bootstrap(PriceableEquityAssets, curveId.BaseDate, termCurve.extrapolationPermitted,
                                                                 termCurve.interpolationMethod, Tolerance);
            CreatePricingStructure(curveId, termCurve, PriceableEquityAssets);
            // Interpolate the DiscountFactor curve based on the respective curve interpolation
            DateTime baseDate = PricingStructureIdentifier.BaseDate;

            SetInterpolator(baseDate);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FxCurve"/> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="nameSpace">THe client namespace</param>
        /// <param name="fpmlData">The FPML data.</param>
        /// <param name="properties">The properties.</param>
        /// <param name="fixingCalendar">The fixingCalendar.</param>
        /// <param name="rollCalendar">The rollCalendar.</param>
        public EquityCurve(ILogger logger, ICoreCache cache, string nameSpace,
                           Pair <PricingStructure, PricingStructureValuation> fpmlData, NamedValueSet properties,
                           IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar)
            : base(logger, cache, nameSpace, fpmlData, new EquityCurveIdentifier(properties))
        {
            PricingStructureData = new PricingStructureData(CurveType.Parent, AssetClass.Equity, properties);
            if (properties == null)
            {
                properties = PricingStructurePropertyHelper.FxCurve(fpmlData);//TODO
            }
            //Set the spot date;
            SettlementDate = GetSettlementDate(logger, cache, nameSpace, GetEquityCurveId(), fixingCalendar, rollCalendar, PricingStructureValuation.baseDate.Value);
            var fxCurveValuation = (FxCurveValuation)fpmlData.Second;

            // hack - set the base date - todo - is this the right place alex?
            PricingStructureValuation.baseDate = new IdentifiedDate {
                Value = PricingStructureIdentifier.BaseDate
            };
            SetFpmlData(fpmlData);
            TermCurve termCurve = SetConfigurationData();
            var       bootstrap = PropertyHelper.ExtractBootStrapOverrideFlag(properties);
            var       buildFlag = (fxCurveValuation.spotRate != null) && (fxCurveValuation.fxForwardCurve == null || fxCurveValuation.fxForwardCurve.point == null);

            // If there's no forward points - do build the curve.
            // - TODO what happened the central bank dates
            if ((bootstrap || buildFlag) && cache != null)
            {
                // if (BootstrapperName == "FastBootstrapper") //TODO
                PriceableEquityAssets = PriceableAssetFactory.CreatePriceableEquityAssets(logger, cache, nameSpace,
                                                                                          fxCurveValuation.baseDate.Value, fxCurveValuation.spotRate, fixingCalendar, rollCalendar);
                fxCurveValuation.fxForwardCurve       = termCurve;
                fxCurveValuation.fxForwardCurve.point = EquityBootstrapper.Bootstrap(
                    PriceableEquityAssets,
                    fxCurveValuation.baseDate.Value,
                    fxCurveValuation.fxForwardCurve.extrapolationPermitted,
                    fxCurveValuation.fxForwardCurve.interpolationMethod);
            }
            ((FxCurveValuation)PricingStructureValuation).fxForwardCurve = fxCurveValuation.fxForwardCurve;
            SetInterpolator(PricingStructureValuation.baseDate.Value);
        }
Ejemplo n.º 4
0
        private void InitialiseInstance(ILogger logger, ICoreCache cache, string nameSpace,
                                        NamedValueSet properties, FxRateSet assetSet, IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar)
        {
            PricingStructureData = new PricingStructureData(CurveType.Parent, AssetClass.Equity, properties);
            var curveId = new EquityCurveIdentifier(properties);

            PricingStructureIdentifier = curveId;
            Holder = new PricingStructureAlgorithmsHolder(logger, cache, nameSpace, curveId.PricingStructureType, curveId.Algorithm);
            DateTime baseDate = PricingStructureIdentifier.BaseDate;

            //Set the spot date;
            SettlementDate = GetSettlementDate(logger, cache, nameSpace, GetEquityCurveId(), fixingCalendar, rollCalendar, baseDate);
            //TODO
            //FixingCalendar = null;
            //RollCalendar = null;
            // The bootstrapper to use
            BootstrapperName = Holder.GetValue("Bootstrapper");
            Tolerance        = double.Parse(Holder.GetValue("Tolerance"));
            bool extrapolationPermitted             = bool.Parse(Holder.GetValue("ExtrapolationPermitted"));
            InterpolationMethod interpolationMethod = InterpolationMethodHelper.Parse(Holder.GetValue("BootstrapperInterpolation"));
            var termCurve = new TermCurve
            {
                extrapolationPermitted          = extrapolationPermitted,
                extrapolationPermittedSpecified = true,
                interpolationMethod             = interpolationMethod
            };

            PriceableEquityAssets = PriceableAssetFactory.CreatePriceableEquityAssets(logger, cache, nameSpace, baseDate, assetSet, fixingCalendar, rollCalendar);
            termCurve.point       = EquityBootstrapper.Bootstrap(PriceableEquityAssets, baseDate, termCurve.extrapolationPermitted,
                                                                 termCurve.interpolationMethod, Tolerance);
            // Pull out the fx curve and fx curve valuation
            Pair <PricingStructure, PricingStructureValuation> fpmlData
                = CreateFpmlPair(logger, cache, nameSpace, baseDate, (EquityCurveIdentifier)PricingStructureIdentifier, assetSet, termCurve, fixingCalendar, rollCalendar);

            SetFpmlData(fpmlData);
            // Interpolate the DiscountFactor curve based on the respective curve interpolation
            SetInterpolator(baseDate);
        }