コード例 #1
0
        public string PublishCurve(object[][] structurePropertiesRange, object[][] publishPropertiesRange, object[][] valuesRange)
        {
            // Create curve
            IPricingStructure pricingStructure = PricingStructureFactory.CreatePricingStructure(Logger.Target, Cache, NameSpace, structurePropertiesRange, valuesRange);
            // Get properties needed
            Market        market           = GetMarket(pricingStructure);
            string        uniqueIdentifier = pricingStructure.GetPricingStructureId().UniqueIdentifier;
            NamedValueSet properties       = pricingStructure.GetPricingStructureId().Properties;

            // Save
            Publish(market, uniqueIdentifier, properties, publishPropertiesRange);
            return(uniqueIdentifier);
        }
コード例 #2
0
        public string PublishVolatilityCube(object[][] structurePropertiesRange, object[][] publishPropertiesRange, object[][] strikesOrTenorsRange, object[][] valuesRange)
        {
            // Translate into useful objects
            NamedValueSet structureProperties = structurePropertiesRange.ToNamedValueSet();
            var           data = (object[, ])PricingStructureFactory.TrimNulls(valuesRange.ConvertArrayToMatrix());

            decimal[] strikes  = strikesOrTenorsRange.ConvertToOneDimensionalArray <decimal>();
            string[]  expiries = PricingStructureFactory.ExtractExpiries(data).Distinct().ToArray();
            string[]  tenors   = PricingStructureFactory.ExtractTenors(data).Distinct().ToArray();
            decimal[,] vols = PricingStructureFactory.ConvertToDecimalArray(data, 2);
            // Create curve
            var volatilityCube = new VolatilityCube(structureProperties, expiries, tenors, vols, strikes);
            // Get properties needed
            Market        market           = GetMarket(volatilityCube);
            string        uniqueIdentifier = volatilityCube.GetPricingStructureId().UniqueIdentifier;
            NamedValueSet properties       = volatilityCube.GetPricingStructureId().Properties;

            // Save
            Publish(market, uniqueIdentifier, properties, publishPropertiesRange);
            return(uniqueIdentifier);
        }