Esempio n. 1
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                ISDPAccountingFunction sDPAccountingFunctionItem = item.As <ISDPAccountingFunction>();

                if (((sDPAccountingFunctionItem != null) &&
                     this._parent.SPAccountingFunctions.Remove(sDPAccountingFunctionItem)))
                {
                    return(true);
                }
                IServiceDeliveryPoint serviceDeliveryPointItem = item.As <IServiceDeliveryPoint>();

                if (((serviceDeliveryPointItem != null) &&
                     this._parent.ServiceDeliveryPoints.Remove(serviceDeliveryPointItem)))
                {
                    return(true);
                }
                ICustomerAgreement customerAgreementItem = item.As <ICustomerAgreement>();

                if (((customerAgreementItem != null) &&
                     this._parent.CustomerAgreements.Remove(customerAgreementItem)))
                {
                    return(true);
                }
                IPricingStructure pricingStructureItem = item.As <IPricingStructure>();

                if (((pricingStructureItem != null) &&
                     this._parent.PricingStructures.Remove(pricingStructureItem)))
                {
                    return(true);
                }
                return(false);
            }
Esempio n. 2
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ISDPAccountingFunction sPAccountingFunctionsCasted = item.As <ISDPAccountingFunction>();

                if ((sPAccountingFunctionsCasted != null))
                {
                    this._parent.SPAccountingFunctions.Add(sPAccountingFunctionsCasted);
                }
                IServiceDeliveryPoint serviceDeliveryPointsCasted = item.As <IServiceDeliveryPoint>();

                if ((serviceDeliveryPointsCasted != null))
                {
                    this._parent.ServiceDeliveryPoints.Add(serviceDeliveryPointsCasted);
                }
                ICustomerAgreement customerAgreementsCasted = item.As <ICustomerAgreement>();

                if ((customerAgreementsCasted != null))
                {
                    this._parent.CustomerAgreements.Add(customerAgreementsCasted);
                }
                IPricingStructure pricingStructuresCasted = item.As <IPricingStructure>();

                if ((pricingStructuresCasted != null))
                {
                    this._parent.PricingStructures.Add(pricingStructuresCasted);
                }
            }
        ///<summary>
        /// Creates a market environment for use in calculations.
        ///</summary>
        ///<param name="marketName">The name of the market environment.</param>
        ///<param name="curve">The curve.</param>
        ///<returns></returns>
        public static IMarketEnvironment Create(string marketName, IPricingStructure curve)
        {
            var environment = new MarketEnvironment(marketName);
            var name        = (PricingStructureIdentifier)curve.GetPricingStructureId();

            environment.AddPricingStructure(name.UniqueIdentifier, curve);
            return(environment);
        }
Esempio n. 4
0
        ///<summary>
        /// Creates the specified curve type.
        ///</summary>
        ///<param name="structurePropertiesRange">The properties range. This must include all mandatory properties.</param>
        ///<param name="valuesRange">The values to be used for bootstrapping.</param>
        ///<returns>A handle to a bootstrapped pricing structure.</returns>
        ///<exception cref="NotImplementedException"></exception>
        private string CreatePricingStructure(object[,] structurePropertiesRange, object[,] valuesRange)
        {
            IPricingStructure pricingStructure = Engine.CreatePricingStructure(structurePropertiesRange.ToNamedValueSet(), valuesRange);
            string            structureId      = pricingStructure.GetPricingStructureId().UniqueIdentifier;

            Engine.SaveCurve(pricingStructure);
            return(structureId);
        }
        private static Market GetMarket(IPricingStructure pricingStructure)
        {
            string uniqueIdentifier = pricingStructure.GetPricingStructureId().UniqueIdentifier;
            var    fpml             = pricingStructure.GetFpMLData();
            Market market           = PricingStructureHelper.CreateMarketFromFpML(uniqueIdentifier, fpml);

            return(market);
        }
Esempio n. 6
0
        private static ISwapLegEnvironment CreateMarket(IPricingStructure discountCurve, IPricingStructure forwardCurve)
        {
            var market = new SwapLegEnvironment();

            market.AddPricingStructure(InterestRateStreamPSTypes.DiscountCurve.ToString(), discountCurve);
            market.AddPricingStructure(InterestRateStreamPSTypes.ForecastCurve.ToString(), forwardCurve);
            market.AddPricingStructure(InterestRateStreamPSTypes.ReportingCurrencyFxCurve.ToString(), null);
            return(market);
        }
Esempio n. 7
0
 ///<summary>
 ///</summary>
 ///<param name="name"></param>
 ///<param name="pricingStructure"></param>
 public void AddPricingStructure(string name, IPricingStructure pricingStructure)
 {
     if (pricingStructure != null)
     {
         if (PricingStructures.ContainsKey(name))
         {
             PricingStructures.Remove(name);
         }
         PricingStructures.Add(name, pricingStructure);
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.PricingStructure == null))
     {
         IPricingStructure pricingStructureCasted = item.As <IPricingStructure>();
         if ((pricingStructureCasted != null))
         {
             this._parent.PricingStructure = pricingStructureCasted;
             return;
         }
     }
 }
        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);
        }
Esempio n. 10
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ITariffProfile tariffProfilesCasted = item.As <ITariffProfile>();

                if ((tariffProfilesCasted != null))
                {
                    this._parent.TariffProfiles.Add(tariffProfilesCasted);
                }
                IPricingStructure pricingStructuresCasted = item.As <IPricingStructure>();

                if ((pricingStructuresCasted != null))
                {
                    this._parent.PricingStructures.Add(pricingStructuresCasted);
                }
            }
Esempio n. 11
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                ITariffProfile tariffProfileItem = item.As <ITariffProfile>();

                if (((tariffProfileItem != null) &&
                     this._parent.TariffProfiles.Remove(tariffProfileItem)))
                {
                    return(true);
                }
                IPricingStructure pricingStructureItem = item.As <IPricingStructure>();

                if (((pricingStructureItem != null) &&
                     this._parent.PricingStructures.Remove(pricingStructureItem)))
                {
                    return(true);
                }
                return(false);
            }
Esempio n. 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RateBasisCurve"/> class.
 /// </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.</param>
 /// <param name="refCurve">The reference parent curve id.</param>
 /// <param name="value">The values.</param>
 /// <param name="fixingCalendar">The fixingCalendar.</param>
 /// <param name="rollCalendar">The rollCalendar.</param>
 public RateBasisCurve(ILogger logger, ICoreCache cache, string nameSpace, NamedValueSet properties, IPricingStructure refCurve, Decimal value,
                       IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar)
     : base(logger, cache, nameSpace, AdjustMarketQuotes(value, refCurve.GetFpMLData(), PropertyHelper.ExtractUniqueCurveIdentifier(properties)), properties,
            fixingCalendar, rollCalendar)
 {
     PricingStructureData = new PricingStructureData(CurveType.Child, AssetClass.Rates, properties);
     ReferenceCurveId     = refCurve.GetPricingStructureId();
 }
        ///<summary>
        /// Creates a market environment for use in calculations.
        ///</summary>
        ///<param name="marketName">The name of the market environment.</param>
        ///<param name="uniqueIdentifier">The unique Identifier.</param>
        ///<param name="curve">The curve.</param>
        ///<returns></returns>
        public static ISimpleMarketEnvironment CreateSimpleEnvironment(string marketName, string uniqueIdentifier, IPricingStructure curve)
        {
            var environment = new SimpleMarketEnvironment(marketName, uniqueIdentifier, curve);

            return(environment);
        }
        /// <summary>
        /// Stores the structure.
        /// </summary>
        /// <param name="marketEnvironment">The market environment.</param>
        /// <param name="name">The name.</param>
        /// <param name="pricingStructure">The pricing structure.</param>
        /// <returns></returns>
        public static IMarketEnvironment StoreStructure(IMarketEnvironment marketEnvironment, string name, IPricingStructure pricingStructure)
        {
            var market = (MarketEnvironment)marketEnvironment;

            if (!StructureExists(marketEnvironment, name))
            {
                market.AddPricingStructure(name, pricingStructure);
            }
            return(market);
        }
Esempio n. 15
0
 ///<summary>
 /// A simple market environment can only contain a maximum of 1 pricingStructure:
 /// </summary>
 ///<param name="marketId">The marketId</param>
 ///<param name="uniqueIdentifier">The uniqueIdentifier</param>
 ///<param name="pricingStructure">The pricingStructure</param>
 public SimpleMarketEnvironment(string marketId, string uniqueIdentifier, IPricingStructure pricingStructure)
     : base(marketId)
 {
     PricingStructureIdentifier = uniqueIdentifier;
     PricingStructures.Add(PricingStructureIdentifier, pricingStructure);
 }