Esempio n. 1
0
        public void ConvertQuotedAssetSetsToRateCurveDefinition()
        {
            const string curveType = "RateCurve";

            using (var logger = Reference <ILogger> .Create(new TraceLogger(true)))
            {
                using (ICoreClient client = (new CoreClientFactory(logger)).SetEnv(BuildConst.BuildEnv).Create())
                {
                    IterateCurveProperties((ccy, index, marketName, tenor) =>
                    {
                        string indexName   = $"{ccy}-{index}";
                        string curveName   = $"{indexName}-{tenor}";
                        string qasItemName = String.Format("Orion.V5r3.QuotedAssetSet.{0}.{4}.{1}-{2}-{3}",
                                                           marketName, ccy, index, tenor, curveType);
                        // outputs
                        string curveItemName = String.Format("Orion.V5r3.Configuration.PricingStructures.{0}.{4}.{1}-{2}-{3}",
                                                             marketName, ccy, index, tenor, curveType);
                        var marketData = client.LoadObject <QuotedAssetSet>(qasItemName);
                        if (marketData != null)
                        {
                            RemoveMarketQuoteValues(marketData);
                            var curveDef = new Market
                            {
                                id    = curveName,
                                Items = new PricingStructure[] { new YieldCurve {
                                                                     id = curveName
                                                                 } },
                                Items1 = new PricingStructureValuation[] {
                                    new YieldCurveValuation {
                                        id = curveName, inputs = marketData
                                    }
                                }
                            };
                            var curveProps = new NamedValueSet();
                            curveProps.Set(CurveProp.Market, marketName);
                            curveProps.Set(CurveProp.PricingStructureType, curveType);
                            curveProps.Set(CurveProp.IndexName, indexName);
                            curveProps.Set(CurveProp.IndexTenor, tenor);
                            curveProps.Set(CurveProp.CurveName, curveName);
                            curveProps.Set("Algorithm", "FastLinearZero");
                            curveProps.Set(CurveProp.Currency1, ccy);
                            curveProps.Set(CurveProp.DataGroup, "Orion.V5r3.Configuration.PricingStructureType");
                            curveProps.Set("SourceSystem", "Orion");
                            curveProps.Set("Function", "Configuration");
                            curveProps.Set("Type", CurveProp.PricingStructureType);
                            curveProps.Set(CurveProp.UniqueIdentifier, curveItemName);
                            client.SaveObject(curveDef, curveItemName, curveProps, TimeSpan.MaxValue);
                        }
                    });
                }
            }
        }
Esempio n. 2
0
        public void ConvertQuotedAssetSetsToDiscountCurveDefinition()
        {
            using (var logger = Reference <ILogger> .Create(new TraceLogger(true)))
            {
                using (ICoreClient client = (new CoreClientFactory(logger)).SetEnv(BuildConst.BuildEnv).Create())
                {
                    const string instrument = "LIBOR";
                    const string seniority  = "SENIOR";
                    foreach (string ccy in "AUD;USD;EUR;NZD;GBP".Split(';'))
                    {
                        foreach (string marketName in CurveConst.QR_LIVE.Split(';'))
                        {
                            //foreach (string tenor in "3M".Split(';'))
                            {
                                //string indexName = String.Format("{0}-{1}", ccy, index);
                                string curveName   = $"{ccy}-{instrument}-{seniority}";
                                string qasItemName = $"Orion.V5r3.MarketData.{marketName}.DiscountCurve.{curveName}";
                                // outputs
                                string curveItemName =
                                    $"Orion.V5r3.Configuration.PricingStructures.{marketName}.DiscountCurve.{curveName}";
                                var marketData = client.LoadObject <QuotedAssetSet>(qasItemName);
                                if (marketData != null)
                                {
                                    // strip out market quote values
                                    foreach (var tradeItem in marketData.assetQuote)
                                    {
                                        foreach (var quote in tradeItem.quote)
                                        {
                                            if (quote.measureType.Value == "MarketQuote")
                                            {
                                                quote.valueSpecified = false;
                                                quote.value          = 0.0m;
                                            }
                                        }
                                    }
                                    var curveDef = new Market
                                    {
                                        id    = curveName,
                                        Items = new PricingStructure[] { new YieldCurve {
                                                                             id = curveName
                                                                         } },
                                        Items1 = new PricingStructureValuation[] {
                                            new YieldCurveValuation {
                                                id = curveName, inputs = marketData
                                            }
                                        }
                                    };

                                    var curveProps = new NamedValueSet();
                                    curveProps.Set(CurveProp.Market, marketName);
                                    curveProps.Set(CurveProp.PricingStructureType, "DiscountCurve");
                                    //curveProps.Set(CurveProp.IndexName, indexName);
                                    //curveProps.Set(CurveProp.IndexTenor, tenor);
                                    curveProps.Set("CreditInstrumentId", instrument);
                                    curveProps.Set("CreditSeniority", seniority);
                                    curveProps.Set(CurveProp.CurveName, curveName);
                                    curveProps.Set("Algorithm", "FastLinearZero");
                                    curveProps.Set(CurveProp.Currency1, ccy);
                                    curveProps.Set(CurveProp.DataGroup, "Orion.V5r3.Configuration.PricingStructureType");
                                    curveProps.Set("SourceSystem", "Orion");
                                    curveProps.Set("Function", "Configuration");
                                    curveProps.Set("Type", CurveProp.PricingStructureType);
                                    curveProps.Set(CurveProp.UniqueIdentifier, curveItemName);
                                    client.SaveObject(curveDef, curveItemName, curveProps, TimeSpan.MaxValue);
                                }
                            }
                        }
                    }
                }
            }
        }