コード例 #1
0
        //public static Market CreateYieldCurveConfiguration(string curveId, string[] assetIdentifiers)
        //{
        //    var market = new Market {id = curveId};

        //    //Create the quotedAssetSet.
        //    var qas = QuotedAssetSetFactory.Parse(assetIdentifiers);

        //    //Create the curve information.
        //    var curve = new YieldCurve {id = curveId};

        //    //reate the valuation structure that contains qas.
        //    var curveValuation = new YieldCurveValuation {id = curveId, inputs = qas};

        //    //Set the market.
        //    market.Items = new[] { (PricingStructure)curve };
        //    market.Items1 = new[] { (PricingStructureValuation)curveValuation };

        //    return market;
        //}

        public static Market CreateFxCurveConfiguration(string curveId, string currency1, string currency2, string quoteBasis, FxRateSet quotedAssetSet)
        {
            //<QuoteBasisEnum>
            var basis = EnumHelper.Parse <QuoteBasisEnum>(quoteBasis, true);
            var quotedCurrencyPair = QuotedCurrencyPair.Create(currency1, currency2, basis);
            var currency           = CurrencyHelper.Parse(currency1);
            var market             = new Market {
                id = curveId
            };

            //Create the curve information.
            var curve = new FxCurve {
                id = curveId, name = curveId, currency = currency, quotedCurrencyPair = quotedCurrencyPair
            };

            //reate the valuation structure that contains qas.
            var curveValuation = new FxCurveValuation {
                id = curveId, spotRate = quotedAssetSet
            };

            //Set the market.
            market.Items  = new[] { (PricingStructure)curve };
            market.Items1 = new[] { (PricingStructureValuation)curveValuation };

            return(market);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XccySpreadCurve"/> 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 for the pricing strucuture.</param>
        /// <param name="fixingCalendar">The fixingCalendar.</param>
        /// <param name="rollCalendar">The rollCalendar.</param>
        public XccySpreadCurve(ILogger logger, ICoreCache cache, String nameSpace,
                               Pair <PricingStructure, PricingStructureValuation> fpmlData,
                               NamedValueSet properties, IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar)
            : base(logger, cache, nameSpace, new RateCurveIdentifier(properties))
        {
            SetFpMLData(fpmlData, false);
            var yieldCurveValuation = (YieldCurveValuation)fpmlData.Second;

            BasicAssetValuation[] assetQuote = yieldCurveValuation.inputs.assetQuote;
            string     algorithm             = ((YieldCurve)fpmlData.First).algorithm;
            DateTime   baseDate   = yieldCurveValuation.baseDate.Value;
            IRateCurve baseCurve  = ExtractCurve(logger, cache, nameSpace, assetQuote, BaseCurveName, algorithm, baseDate, fixingCalendar, rollCalendar);
            IRateCurve quoteCurve = ExtractCurve(logger, cache, nameSpace, assetQuote, QuoteCurveName, algorithm, baseDate, fixingCalendar, rollCalendar);

            string[]  fxInstruments = ExtractInstruments(assetQuote, FxCurveName);
            decimal[] fxValues      = ExtractValues(assetQuote, FxCurveName);
            FxCurve   fxCurve       = null;

            if (fxInstruments.Any())
            {
                string curveName         = $"{fxInstruments[0].Substring(0, 3)}-{fxInstruments[0].Substring(3, 3)}";
                var    curveId           = new FxCurveIdentifier(PricingStructureTypeEnum.FxCurve, curveName, baseDate);
                var    qas               = AssetHelper.ParseToFxRateSet(fxInstruments, fxValues, null);
                var    fxCurveProperties = curveId.GetProperties();
                fxCurve = new FxCurve(logger, cache, nameSpace, fxCurveProperties, qas, fixingCalendar, rollCalendar);
            }
            var instruments = ExtractInstruments(assetQuote, null);
            var values      = ExtractValues(assetQuote, null);

            Initialize(logger, cache, nameSpace, properties, baseCurve, quoteCurve, instruments, values, fxCurve, fixingCalendar, rollCalendar);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fxCurve"></param>
        /// <param name="usdCurve"></param>
        /// <param name="currency"></param>
        /// <param name="baseDate"></param>
        /// <param name="algorithmHolder"></param>
        /// <returns></returns>
        public static RateCurve CreateBasisAdjustedDiscountCurve(FxCurve fxCurve, IRateCurve usdCurve, string currency,
                                                                 DateTime baseDate, PricingStructureAlgorithmsHolder algorithmHolder)
        {
            string quoteCurrency = ((FxCurveIdentifier)fxCurve.GetPricingStructureId()).QuoteCurrency.Value;
            double power         = quoteCurrency == currency ? -1 : 1;
            double fxRate0       = Math.Pow(fxCurve.GetForward(baseDate), power);
            var    newPoints     = new Dictionary <DateTime, Pair <string, decimal> >();

            foreach (TermPoint point in fxCurve.GetTermCurve().point)
            {
                var    pillarPoint     = (DateTime)point.term.Items[0];
                double fxRateN         = Math.Pow(fxCurve.GetForward(pillarPoint), power);
                double discountFactorN = usdCurve.GetDiscountFactor(pillarPoint);
                var    quoteBasisAdjustedDiscountFactor = (decimal)(discountFactorN * fxRateN / fxRate0);
                newPoints.Add(pillarPoint, new Pair <string, decimal>(point.id, quoteBasisAdjustedDiscountFactor));
            }
            var newProperties
                = new Dictionary <string, object>
                {
                { CurveProp.PricingStructureType, "RateCurve" },
                { CurveProp.Market, "DiscountCurveConstruction" },
                { CurveProp.IndexTenor, "0M" },
                { CurveProp.Currency1, currency },
                { CurveProp.IndexName, "XXX-XXX" },
                { CurveProp.Algorithm, "FastLinearZero" },
                { CurveProp.BaseDate, baseDate },
                };
            var namedValueSet = new NamedValueSet(newProperties);

            return(new RateCurve(namedValueSet, algorithmHolder, newPoints));//There is no compounding frequency propertty
        }
コード例 #4
0
        private void Initialize(ILogger logger, ICoreCache cache, string nameSpace, NamedValueSet properties, IRateCurve baseCurve, IRateCurve quoteCurve,
                                string[] instruments, decimal[] values, FxCurve fxCurve, IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar)
        {
            var curveId = (RateCurveIdentifier)PricingStructureIdentifier;

            BaseCurve  = baseCurve;
            QuoteCurve = quoteCurve;
            //Holder = new PricingStructureAlgorithmsHolder(logger, cache, curveId.PricingStructureType, curveId.Algorithm);
            Initialize(properties, Holder);
            var currency = properties.GetValue <string>(CurveProp.Currency1);

            if (fxCurve != null && baseCurve == null)
            {
                var holder = new GenericRateCurveAlgorithmHolder(logger, cache, nameSpace);
                // Create discount factors, without any input points
                RateCurve basisAdjustedDiscountCurve = CreateBasisAdjustedDiscountCurve(fxCurve, quoteCurve, currency, curveId.BaseDate, holder);
                TermCurve discountCurve = ((YieldCurveValuation)basisAdjustedDiscountCurve.PricingStructureValuation).discountFactorCurve;
                CreateYieldCurve();
                GetYieldCurveValuation().discountFactorCurve = discountCurve;
                SetInterpolator(discountCurve, curveId.Algorithm, PricingStructureTypeEnum.RateSpreadCurve);
                // Put FX curve into inputs
                var assetQuotes = new List <BasicAssetValuation>();
                BasicAssetValuation[] fxAssetQuotes = ((FxCurveValuation)fxCurve.GetFpMLData().Second).spotRate.assetQuote;
                foreach (BasicAssetValuation assetQuote in fxAssetQuotes)
                {
                    BasicAssetValuation clonedAssetQuote = XmlSerializerHelper.Clone(assetQuote);
                    clonedAssetQuote.definitionRef = FxCurveName;
                    assetQuotes.Add(clonedAssetQuote);
                }
                AddQuoteCurveInputs(assetQuotes);
                ((YieldCurveValuation)PricingStructureValuation).inputs = new QuotedAssetSet {
                    assetQuote = assetQuotes.ToArray()
                };
            }
            else
            {
                List <IPriceableRateAssetController> swaps
                    = PriceableAssetFactory.CreatePriceableRateAssets(logger, cache, nameSpace, curveId.BaseDate, instruments, values, null, fixingCalendar, rollCalendar);
                if (fxCurve == null)
                {
                    // only use the input swaps
                    PriceableRateAssets = swaps;
                }
                else
                {
                    var holder = new GenericRateCurveAlgorithmHolder(logger, cache, nameSpace);
                    // Add synthetic input points
                    RateCurve basisAdjustedDiscountCurve = CreateBasisAdjustedDiscountCurve(fxCurve, quoteCurve, currency, curveId.BaseDate, holder);
                    //TODO Add some extra short end point: 1D and 1W
                    string[] syntheticSwapPoints = { "1M", "2M", "3M", "6M", "9M" };
                    PriceableRateAssets = CreateSyntheticSwaps(logger, cache, nameSpace, BaseCurve, basisAdjustedDiscountCurve,
                                                               currency, curveId.BaseDate, syntheticSwapPoints, fixingCalendar, rollCalendar);
                    PriceableRateAssets.AddRange(swaps);
                }
                // bootstrap to create the discount factors
                PriceableRateAssets = PriceableRateAssets.OrderBy(a => a.GetRiskMaturityDate()).ToList();
                Bootstrap((YieldCurveValuation)GetFpMLData().Second);
            }
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FxDerivedCurve"/> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="cache">The cache.</param>
 /// <param name="nameSpace">The client namespace</param>
 /// <param name="curve1">The currency1 data. This should be against USD.
 /// This must also be the currency1 curve for the derived fx curve.</param>
 /// <param name="curve2">The currency2 data. This should be against USD.</param>
 /// <param name="newFxCurveProperties">The new FxCurve properties .</param>
 public FxDerivedCurve(ILogger logger, ICoreCache cache, string nameSpace, FxCurve curve1, FxCurve curve2, NamedValueSet newFxCurveProperties)
 {
     PricingStructureData       = new PricingStructureData(CurveType.Child, AssetClass.Fx, newFxCurveProperties);
     FxCurve1                   = curve1;
     FxCurve2                   = curve2;
     Currency1                  = curve1.GetQuotedCurrencyPair().currency1.Value != "USD" ? curve1.GetQuotedCurrencyPair().currency1.Value : curve1.GetQuotedCurrencyPair().currency2.Value;
     Currency2                  = curve2.GetQuotedCurrencyPair().currency1.Value != "USD" ? curve2.GetQuotedCurrencyPair().currency1.Value : curve2.GetQuotedCurrencyPair().currency2.Value;
     SpotDate                   = GetSpotDate(logger, cache, nameSpace, null, null, FxCurve1.GetBaseDate());//Create the new identifier.
     PricingStructureIdentifier = new FxCurveIdentifier(newFxCurveProperties);
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XccySpreadCurve"/> class,
 /// by applying spreads to an existing RateCurve. Using FX Curve to create synthetic swaps
 /// for the period under 1Y.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="cache">The cache.</param>
 /// <param name="nameSpace">The client namespace</param>
 /// <param name="properties">The properties of the new curve.</param>
 /// <param name="baseCurve">The base zero curve.</param>
 /// <param name="quoteCurve">The quote zero curve.</param>
 /// <param name="fxCurve">The FX curve, used for constructing synthetic deposits</param>
 /// <param name="inputs">The quoted asset instruments.</param>
 /// <param name="fixingCalendar">The fixingCalendar.</param>
 /// <param name="rollCalendar">The rollCalendar.</param>
 public XccySpreadCurve(ILogger logger, ICoreCache cache, String nameSpace, NamedValueSet properties, QuotedAssetSet inputs,
                        IRateCurve baseCurve, IRateCurve quoteCurve, FxCurve fxCurve,
                        IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar)
     : base(logger, cache, nameSpace, new RateCurveIdentifier(properties))
 {
     BasicAssetValuation[] assetQuote = inputs.assetQuote;
     string[]  instruments            = ExtractInstruments(assetQuote, null);
     decimal[] values = ExtractValues(assetQuote, null);
     Initialize(logger, cache, nameSpace, properties, baseCurve, quoteCurve, instruments, values, fxCurve, fixingCalendar, rollCalendar);
 }
コード例 #7
0
        /// <summary>
        /// Clones the curve.
        /// </summary>
        /// <returns></returns>
        public object Clone()//THis does not instantiate any priceable assets or bootstrap the curve. This means no evaluation of component assets.
        {
            //Clone the properties and set values.
            //
            NamedValueSet properties  = GetProperties().Clone();
            string        baseCurveId = properties.GetString(CurveProp.UniqueIdentifier, true);
            string        id          = baseCurveId + ".Clone";

            properties.Set(CurveProp.UniqueIdentifier, id);
            //Clone the curve data.
            //
            Pair <PricingStructure, PricingStructureValuation> fpml = GetFpMLData();
            var fxCurve = new FxCurve(null, null, null, CloneCurve(fpml, id), properties, null, null, false);

            return(fxCurve);
        }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XccySpreadCurve"/> class,
 /// by applying spreads to an existing RateCurve. Using FX Curve to create synthetic swaps
 /// for the period under 1Y.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="cache">The cache.</param>
 /// <param name="nameSpace">The client namespace</param>
 /// <param name="properties">The properties of the new curve.</param>
 /// <param name="baseCurve">The base zero curve.</param>
 /// <param name="quoteCurve">The quote zero curve.</param>
 /// <param name="fxCurve">The FX curve, used for constructing synthetic deposits</param>
 /// <param name="instruments">The spread instruments.</param>
 /// <param name="values">The spread values.</param>
 /// <param name="fixingCalendar">The fixingCalendar.</param>
 /// <param name="rollCalendar">The rollCalendar.</param>
 public XccySpreadCurve(ILogger logger, ICoreCache cache, String nameSpace, NamedValueSet properties, IRateCurve baseCurve, IRateCurve quoteCurve, FxCurve fxCurve,
                        string[] instruments, decimal[] values, IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar)
     : base(logger, cache, nameSpace, new RateCurveIdentifier(properties))
 {
     Initialize(logger, cache, nameSpace, properties, baseCurve, quoteCurve, instruments, values, fxCurve, fixingCalendar, rollCalendar);
 }
コード例 #9
0
        public void TestUsingDerivedTypes()
        {
            // tests control of the serialisation type
            // - type b (derived from a) is saved as b, loaded as b;
            // - type b (derived from a) is saved as a, loaded as a (but is type b).
            // (in this example a = PricingStructure, b = YieldCurve)
            using (Reference <ILogger> loggerRef = Reference <ILogger> .Create(new TraceLogger(true)))
            {
                using (ICoreClient client = new PrivateCore(loggerRef.Target))
                {
                    {
                        YieldCurve dataA = new YieldCurve()
                        {
                            currency = new Currency()
                            {
                                Value = "USD"
                            },
                            algorithm = "FastCubicSpline"
                        };
                        // - save as derived type
                        client.SaveObject(dataA, "TestA", null, TimeSpan.MaxValue);
                        ICoreItem test1 = client.LoadItem <YieldCurve>("TestA");
                        Assert.IsNotNull(test1);
                        Assert.AreEqual(typeof(YieldCurve).FullName, test1.DataTypeName);
                        Assert.AreEqual(typeof(YieldCurve), test1.DataType);
                        Assert.IsNotNull(test1.Data);
                        Assert.AreEqual(typeof(YieldCurve), test1.Data.GetType());
                        // - save as base type
                        client.SaveObject <PricingStructure>(dataA, "TestA", null, TimeSpan.MaxValue);
                        ICoreItem test2 = client.LoadItem <PricingStructure>("TestA");
                        Assert.IsNotNull(test2);
                        Assert.AreEqual(typeof(PricingStructure).FullName, test2.DataTypeName);
                        Assert.AreEqual(typeof(PricingStructure), test2.DataType);
                        Assert.IsNotNull(test2.Data);
                        Assert.AreEqual(typeof(YieldCurve), test2.Data.GetType());
                    }
                    {
                        FxCurve dataB = new FxCurve()
                        {
                            quotedCurrencyPair = new QuotedCurrencyPair()
                            {
                                currency1 = new Currency {
                                    Value = "USD"
                                },
                                currency2 = new Currency {
                                    Value = "JPY"
                                },
                                quoteBasis = QuoteBasisEnum.Currency2PerCurrency1
                            }
                        };
                        // - save as derived type
                        client.SaveObject(dataB, "TestB", null, TimeSpan.MaxValue);
                        ICoreItem test1 = client.LoadItem <FxCurve>("TestB");
                        Assert.IsNotNull(test1);
                        Assert.AreEqual(typeof(FxCurve).FullName, test1.DataTypeName);
                        Assert.AreEqual(typeof(FxCurve), test1.DataType);
                        Assert.IsNotNull(test1.Data);
                        Assert.AreEqual(typeof(FxCurve), test1.Data.GetType());

                        // - save as base type
                        client.SaveObject <PricingStructure>(dataB, "TestB", null, TimeSpan.MaxValue);
                        ICoreItem test2 = client.LoadItem <PricingStructure>("TestB");
                        Assert.IsNotNull(test2);
                        Assert.AreEqual(typeof(PricingStructure).FullName, test2.DataTypeName);
                        Assert.AreEqual(typeof(PricingStructure), test2.DataType);
                        Assert.IsNotNull(test2.Data);
                        Assert.AreEqual(typeof(FxCurve), test2.Data.GetType());
                    }
                    {
                        // load a collection of the base type and verify specific types
                        List <ICoreItem> items = client.LoadItems <PricingStructure>(Expr.ALL);
                        Assert.AreEqual(2, items.Count);
                        Dictionary <string, PricingStructure> index = new Dictionary <string, PricingStructure>();
                        foreach (ICoreItem item in items)
                        {
                            index[item.Name] = (PricingStructure)item.Data;
                        }
                        Assert.AreEqual(typeof(YieldCurve), index["TestA"].GetType());
                        Assert.AreEqual(typeof(FxCurve), index["TestB"].GetType());
                    }
                }
            }
        }
コード例 #10
0
        public void TestSerialisingDerivedTypes()
        {
            // tests control of the serialisation type
            // - type b (derived from a) is saved as b, loaded as b;
            // - type b (derived from a) is saved as a, loaded as a (but is type b).
            // (in this example a = PricingStructure, b = YieldCurve)
            using (Reference <ILogger> loggerRef = Reference <ILogger> .Create(new TraceLogger(true)))
            {
                using (CoreServer server = new CoreServer(loggerRef, "UTT", NodeType.Router))
                {
                    // start server
                    server.Start();
                    using (ICoreClient client = new CoreClientFactory(loggerRef).SetEnv("UTT").Create())
                    {
                        {
                            YieldCurve dataA = new YieldCurve
                            {
                                currency = new Currency {
                                    Value = "USD"
                                },
                                algorithm = "FastCubicSpline"
                            };
                            // - save as derived type
                            client.SaveObject(dataA, "TestA", null, TimeSpan.MaxValue);
                            ICoreItem test1 = client.LoadItem <YieldCurve>("TestA");
                            Assert.IsNotNull(test1);
                            Assert.IsNotNull(test1.Text);
                            Assert.AreEqual(
                                "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<yieldCurve xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://www.fpml.org/FpML-5/reporting\">\r\n  <currency>USD</currency>\r\n  <algorithm>FastCubicSpline</algorithm>\r\n</yieldCurve>",
                                test1.Text);
                            Assert.AreEqual(typeof(YieldCurve).FullName, test1.DataTypeName);
                            Assert.AreEqual(typeof(YieldCurve), test1.DataType);
                            Assert.IsNotNull(test1.Data);
                            Assert.AreEqual(typeof(YieldCurve), test1.Data.GetType());

                            // - save as base type
                            client.SaveObject <PricingStructure>(dataA, "TestA", null, TimeSpan.MaxValue);
                            ICoreItem test2 = client.LoadItem <PricingStructure>("TestA");
                            Assert.IsNotNull(test2);
                            Assert.IsNotNull(test2.Text);
                            Assert.AreEqual(
                                "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<PricingStructure xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:q1=\"http://www.fpml.org/FpML-5/reporting\" xsi:type=\"q1:YieldCurve\">\r\n  <q1:currency>USD</q1:currency>\r\n  <q1:algorithm>FastCubicSpline</q1:algorithm>\r\n</PricingStructure>",
                                test2.Text);
                            Assert.AreEqual(typeof(PricingStructure).FullName, test2.DataTypeName);
                            Assert.AreEqual(typeof(PricingStructure), test2.DataType);
                            Assert.IsNotNull(test2.Data);
                            Assert.AreEqual(typeof(YieldCurve), test2.Data.GetType());
                        }
                        {
                            FxCurve dataB = new FxCurve()
                            {
                                quotedCurrencyPair = new QuotedCurrencyPair()
                                {
                                    currency1 = new Currency()
                                    {
                                        Value = "USD"
                                    },
                                    currency2 = new Currency()
                                    {
                                        Value = "JPY"
                                    },
                                    quoteBasis = QuoteBasisEnum.Currency2PerCurrency1
                                }
                            };
                            // - save as derived type
                            client.SaveObject(dataB, "TestB", null, TimeSpan.MaxValue);
                            ICoreItem test1 = client.LoadItem <FxCurve>("TestB");
                            Assert.IsNotNull(test1);
                            Assert.IsNotNull(test1.Text);
                            Assert.AreEqual(
                                "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<fxCurve xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://www.fpml.org/FpML-5/reporting\">\r\n  <quotedCurrencyPair>\r\n    <currency1>USD</currency1>\r\n    <currency2>JPY</currency2>\r\n  </quotedCurrencyPair>\r\n</fxCurve>",
                                test1.Text);
                            Assert.AreEqual(typeof(FxCurve).FullName, test1.DataTypeName);
                            Assert.AreEqual(typeof(FxCurve), test1.DataType);
                            Assert.IsNotNull(test1.Data);
                            Assert.AreEqual(typeof(FxCurve), test1.Data.GetType());
                            // - save as base type
                            client.SaveObject <PricingStructure>(dataB, "TestB", null, TimeSpan.MaxValue);
                            ICoreItem test2 = client.LoadItem <PricingStructure>("TestB");
                            Assert.IsNotNull(test2);
                            Assert.IsNotNull(test2.Text);
                            Assert.AreEqual(
                                "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<PricingStructure xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:q1=\"http://www.fpml.org/FpML-5/reporting\" xsi:type=\"q1:FxCurve\">\r\n  <q1:quotedCurrencyPair>\r\n    <q1:currency1>USD</q1:currency1>\r\n    <q1:currency2>JPY</q1:currency2>\r\n  </q1:quotedCurrencyPair>\r\n</PricingStructure>",
                                test2.Text);
                            Assert.AreEqual(typeof(PricingStructure).FullName, test2.DataTypeName);
                            Assert.AreEqual(typeof(PricingStructure), test2.DataType);
                            Assert.IsNotNull(test2.Data);
                            Assert.AreEqual(typeof(FxCurve), test2.Data.GetType());
                        }
                        {
                            // load a collection of the base type and verify specific types
                            List <ICoreItem> items = client.LoadItems <PricingStructure>(Expr.ALL);
                            Assert.AreEqual(2, items.Count);
                            Dictionary <string, PricingStructure> index = new Dictionary <string, PricingStructure>();
                            foreach (ICoreItem item in items)
                            {
                                index[item.Name] = (PricingStructure)item.Data;
                            }
                            Assert.AreEqual(typeof(YieldCurve), index["TestA"].GetType());
                            Assert.AreEqual(typeof(FxCurve), index["TestB"].GetType());
                        }
                    }
                    // shutdown
                    server.Stop();
                }
            }
        }