コード例 #1
0
        /// <summary>
        /// Returns properties from the pricing structure. <see cref="NamedValueSet"/> class.
        /// </summary>
        /// <param name="fpmlData">The FPML data.</param>
        public static NamedValueSet RateCurve(Pair <PricingStructure, PricingStructureValuation> fpmlData)
        {
            var tempFpML = (YieldCurveValuation)fpmlData.Second;
            var curve    = (YieldCurve)fpmlData.First;
            //Creates the property collection. This should be backward compatible with V1.
            var buildDateTime = tempFpML.buildDateTime;
            var curveName     = "AUD-Dummy-SydneySwapDesk";

            if (curve.name != null)
            {
                curveName = curve.name;
            }
            var baseDate = tempFpML.baseDate.Value;
            var currency = curve.currency.Value;
            var names    = new[]
            {
                "Identifier", CurveProp.CurveName, "Algorithm", CurveProp.PricingStructureType, CurveProp.IndexName, CurveProp.IndexTenor,
                "BuildDateTime", "BaseDate", "Currency"
            };
            var indexName  = curve.forecastRateIndex.floatingRateIndex.Value;
            var indexTenor = curve.forecastRateIndex.indexTenor.ToString();
            var values     = new object[]
            {
                curve.id, curveName, curve.algorithm, "RateCurve",
                indexName, indexTenor, buildDateTime, baseDate, currency
            };
            //Get the values.
            var properties = NamedValueSetHelper.Build(names, values);

            return(properties);
        }
コード例 #2
0
        /// <summary>
        /// Returns properties from the pricing structure. <see cref="NamedValueSet"/> class.
        /// </summary>
        /// <param name="fpmlData">The FPML data.</param>
        public static NamedValueSet FxCurve(Pair <PricingStructure, PricingStructureValuation> fpmlData)
        {
            var valuation = (FxCurveValuation)fpmlData.Second;
            var curve     = (FxCurve)fpmlData.First;
            //Creates the property collection. This should be backward compatible with V1.
            var names         = new[] { "Identifier", CurveProp.CurveName, "Algorithm", CurveProp.PricingStructureType, CurveProp.CurrencyPair, "QuoteBasis", "BuildDateTime", "BaseDate", "Currency" };
            var currencyPair  = curve.quotedCurrencyPair.currency1.Value + "-" + curve.quotedCurrencyPair.currency2.Value;
            var quoteBasis    = curve.quotedCurrencyPair.quoteBasis.ToString();
            var buildDateTime = valuation.buildDateTime;
            var curveName     = "AUD-Dummy-SydneyFxDesk";

            if (curve.name != null)
            {
                curveName = curve.name;
            }
            var baseDate = valuation.baseDate.Value;
            var currency = curve.currency.Value;
            //Get the values.
            var values = new object[]
            {
                curve.id, curveName, "LinearForward", "FxCurve",
                currencyPair, quoteBasis, buildDateTime, baseDate, currency
            };
            var properties = NamedValueSetHelper.Build(names, values);

            return(properties);
        }
コード例 #3
0
        /// <summary>
        /// Returns properties from the pricing structure. <see cref="NamedValueSet"/> class.
        /// </summary>
        /// <param name="fpmlData">The FPML data.</param>
        public static NamedValueSet CommodityCurve(Pair <PricingStructure, PricingStructureValuation> fpmlData)
        {
            var tempFpML = (FxCurveValuation)fpmlData.Second;
            var curve    = (FxCurve)fpmlData.First;
            //Creates the property collection. This should be backward compatible with V1.
            var names = new[] { "Identifier", CurveProp.CurveName, "Algorithm", CurveProp.PricingStructureType, "CommodityAsset",
                                "BuildDateTime", "BaseDate", "Currency" };
            var commodityAsset = curve.name.Split('-')[1];
            var buildDateTime  = tempFpML.buildDateTime;
            var curveName      = "AUD-Dummy-SydneyCommodityDesk";

            if (curve.name != null)
            {
                curveName = curve.name;
            }
            var baseDate = tempFpML.baseDate.Value;
            var currency = curve.currency.Value;
            //Get the values.
            var values = new object[]
            {
                curve.id, curveName, "LinearForward", "CommodityCurve",
                commodityAsset, buildDateTime, baseDate, currency
            };
            var properties = NamedValueSetHelper.Build(names, values);

            return(properties);
        }
コード例 #4
0
        /// <summary>
        /// Returns properties from the pricing structure. <see cref="NamedValueSet"/> class.
        /// </summary>
        /// <param name="fpmlData">The FPML data.</param>
        public static NamedValueSet FxVolatilityMatrix(Pair <PricingStructure, PricingStructureValuation> fpmlData)
        {
            var tempFpML = (VolatilityMatrix)fpmlData.Second;
            var curve    = (VolatilityRepresentation)fpmlData.First;
            //Creates the property collection. This should be backward compatible with V1.
            var buildDateTime = tempFpML.buildDateTime;
            var curveName     = "AUD-Dummy-SydneyFxDesk";

            if (curve.name != null)
            {
                curveName = curve.name;
            }
            var baseDate = tempFpML.baseDate.Value;
            var currency = curve.currency.Value;
            var names    = new[]
            {
                "Identifier", CurveProp.CurveName, "Algorithm", CurveProp.PricingStructureType, "Instrument",
                "BuildDateTime", "BaseDate", "Currency"
            };
            var values = new object[]
            {
                curve.id, curveName, "Linear", "FxVolatilityMatrix",
                curve.asset.href, buildDateTime, baseDate, currency
            };
            //Get the values.
            var properties = NamedValueSetHelper.Build(names, values);

            return(properties);
        }
コード例 #5
0
        /// <summary>
        /// Returns properties from the pricing structure. <see cref="NamedValueSet"/> class.
        /// </summary>
        /// <param name="fpmlData">The FPML data.</param>
        public static NamedValueSet DiscountCurve(Pair <PricingStructure, PricingStructureValuation> fpmlData)
        {
            var tempFpML = (YieldCurveValuation)fpmlData.Second;
            var curve    = (YieldCurve)fpmlData.First;
            //Creates the property collection. This should be backward compatible with V1.
            var buildDateTime = tempFpML.buildDateTime;
            var curveName     = "AUD-Dummy-SydneySwapDesk";

            if (curve.name != null)
            {
                curveName = curve.name;
            }
            var baseDate  = tempFpML.baseDate.Value;
            var currency  = curve.currency.Value;
            var curveData = curveName.Split('-');
            var names     = new[]
            {
                "Identifier", CurveProp.CurveName, "Algorithm", CurveProp.PricingStructureType, "CreditInstrumentId", "CreditInstrumentId",
                "BuildDateTime", "BaseDate", "Currency"
            };
            var values = new object[]
            {
                curve.id, curveName, curve.algorithm, "DiscountCurve",
                curveData[1], curveData[2], buildDateTime, baseDate, currency
            };

            //Get the values.
            var properties = NamedValueSetHelper.Build(names, values);

            return(properties);
        }
コード例 #6
0
        public void BuildTest()
        {
            string[]      names  = { "CurveType", "ExpiryMins" };
            object[]      values = { "RateCurve", 1 };
            NamedValueSet actual = NamedValueSetHelper.Build(names, values);

            Assert.AreEqual("RateCurve", actual.Get("CurveType").ValueString);
            Assert.AreEqual(1, actual.Get("ExpiryMins").Value);
        }
コード例 #7
0
        public void DistinctInstancesTest()
        {
            object[,] properties = new object[, ]
            {
                { "CurveType", "RateCurve" },
                { "ExpiryMins", 1 },
                { "ExpiryMins", 2 }
            };
            NamedValueSet actual = NamedValueSetHelper.DistinctInstances(properties);

            Assert.AreEqual("RateCurve", actual.Get("CurveType").ValueString);
            Assert.AreEqual(1, ((object[])actual.Get("ExpiryMins").Value)[0]);
            Assert.AreEqual(2, ((object[])actual.Get("ExpiryMins").Value)[1]);
        }
コード例 #8
0
        /// <summary>
        /// Returns properties from the pricing structure. <see cref="NamedValueSet"/> class.
        /// </summary>
        /// <param name="fpmlData">The FPML data.</param>
        public static NamedValueSet VolatilityCurve(Pair <PricingStructure, PricingStructureValuation> fpmlData)
        {
            var tempFpML = (VolatilityMatrix)fpmlData.Second;
            var curve    = (VolatilityRepresentation)fpmlData.First;
            //Creates the property collection. This should be backward compatible with V1.
            var buildDateTime = tempFpML.buildDateTime;
            var curveName     = "AUD-Dummy-SydneySwapDesk";

            if (curve.name != null)
            {
                curveName = curve.name;
            }
            var baseDate = tempFpML.baseDate.Value;
            var currency = curve.currency.Value;
            var names    = new[]
            {
                "Identifier", CurveProp.CurveName, "Algorithm", CurveProp.PricingStructureType, "Instrument", CurveProp.IndexName, CurveProp.IndexTenor,
                "BuildDateTime", "BaseDate", "Currency"
            };
            var    instrument = curve.asset.href;
            String indexTenor = null;
            String indexName  = null;
            var    temp       = instrument.Split('-');

            if (temp.Length > 1)
            {
                indexTenor = temp[temp.Length - 1];
                indexName  = string.Join("-", temp, 0, temp.Length - 1);
            }
            var values = new object[]
            {
                curve.id, curveName, "Default", PricingStructureTypeEnum.CapVolatilityCurve.ToString(),
                instrument, indexName, indexTenor, buildDateTime, baseDate, currency
            };
            //Get the values.
            var properties = NamedValueSetHelper.Build(names, values);

            return(properties);
        }