コード例 #1
0
        //Adds a spread to an asset. The spread value is added to each asset in the original curve.
        // The curve is renamed with the id provided.
        //
        /// <summary>
        ///
        /// </summary>
        /// <param name="spreadValue"></param>
        /// <param name="commodityCurve"></param>
        /// <param name="curveId"></param>
        /// <returns></returns>
        protected static Pair <PricingStructure, PricingStructureValuation> AdjustMarketQuotes(Decimal spreadValue,
                                                                                               Pair <PricingStructure, PricingStructureValuation> commodityCurve, string curveId)
        {
            var ycCurveCloned  = XmlSerializerHelper.Clone(commodityCurve.First);
            var ycvCurveCloned = XmlSerializerHelper.Clone(commodityCurve.Second);
            //  assign id to the cloned YieldCurve
            //
            var yc = (FpML.V5r10.Reporting.FxCurve)ycCurveCloned;

            yc.id = curveId;
            //  nullify the discount factor curve to make sure that bootstrapping will happen)
            //
            var ycv = (FxCurveValuation)ycvCurveCloned;

            ycv.fxForwardCurve.point = null;
            ycv.fxForwardPointsCurve = null;
            ycv.fxForwardCurve       = null;
            foreach (var bav in ycv.spotRate.assetQuote)
            {
                bav.quote = MarketQuoteHelper.AddAndReplaceQuotationByMeasureType("MarketQuote",
                                                                                  new List <BasicQuotation>(bav.quote),
                                                                                  spreadValue);
            }

            return(new Pair <PricingStructure, PricingStructureValuation>(yc, ycv));
        }
コード例 #2
0
        //Adds a spread to an asset. The spread value is added to each asset in the original curve.
        //The array of spread values must be the same length as the array of assets.
        // The curve is renamed with the id provided.
        //
        /// <summary>
        ///
        /// </summary>
        /// <param name="spreadValues"></param>
        /// <param name="commodityCurve"></param>
        /// <param name="curveId"></param>
        /// <returns></returns>
        protected static Pair <PricingStructure, PricingStructureValuation> AdjustMarketQuotes(Decimal[] spreadValues,
                                                                                               Pair <PricingStructure, PricingStructureValuation> commodityCurve, string curveId)
        {
            var ycCurveCloned  = XmlSerializerHelper.Clone(commodityCurve.First);
            var ycvCurveCloned = XmlSerializerHelper.Clone(commodityCurve.Second);
            var yc             = (FpML.V5r10.Reporting.FxCurve)ycCurveCloned;

            yc.id = curveId;
            var ycv = (FxCurveValuation)ycvCurveCloned;

            ycv.fxForwardCurve.point = null;
            ycv.fxForwardPointsCurve = null;
            ycv.fxForwardCurve       = null;
            //This strips out the basis swaps.
            //
            ycv.spotRate = AssetHelper.RemoveAssetsFromQuotedAssetSet(AssetTypesEnum.BasisSwap, ycv.spotRate);
            if (spreadValues.Length == ycv.spotRate.instrumentSet.Items.Length)
            {
                var index = 0;
                foreach (var bav in ycv.spotRate.assetQuote)
                {
                    bav.quote = MarketQuoteHelper.AddAndReplaceQuotationByMeasureType("MarketQuote",
                                                                                      new List <BasicQuotation>(bav.quote),
                                                                                      spreadValues[index]);
                    index++;
                }
            }
            return(new Pair <PricingStructure, PricingStructureValuation>(yc, ycv));
        }