示例#1
0
 private void SetProperties(NamedValueSet properties)
 {
     try
     {
         DataType     = "Trade";
         SourceSystem = PropertyHelper.ExtractSourceSystem(properties);
         var tradeId = properties.GetValue <string>(TradeProp.TradeId);
         Id               = tradeId;
         Domain           = SourceSystem + '.' + DataType;
         TradeDate        = properties.GetValue <DateTime>(TradeProp.TradeDate);
         TradeType        = EnumHelper.Parse <ItemChoiceType15>(properties.GetValue <string>(TradeProp.TradeType), true);
         ProductType      = ProductTypeSimpleScheme.ParseEnumString(properties.GetValue <string>(TradeProp.ProductType, false));
         Party1           = properties.GetValue <string>(TradeProp.Party1, false);
         Party2           = properties.GetValue <string>(TradeProp.Party2, false);
         BaseParty        = properties.GetValue <string>(TradeProp.BaseParty);
         CounterParty     = properties.GetValue <string>(TradeProp.CounterPartyId);
         UniqueIdentifier = BuildUniqueId(tradeId);
         if (properties.GetValue <string>(CurveProp.UniqueIdentifier) != null)
         {
             UniqueIdentifier = properties.GetValue <string>(CurveProp.UniqueIdentifier);
         }
         PropertyHelper.Update(Properties, CurveProp.UniqueIdentifier, UniqueIdentifier);
         PropertyHelper.Update(Properties, "Domain", Domain);
     }
     catch
     {
         throw new System.Exception("Invalid tradeid.");
     }
 }
        ///// <summary>
        /////  An id for a ratecurve.
        ///// </summary>
        ///// <param name="sourceSystem">The source system.</param>
        ///// <param name="baseParty">The base Party.</param>
        ///// <param name="reportId">The report Id.</param>
        ///// <param name="calculationDateTime">The calculationDateTime</param>
        //public ValuationReportIdentifier(String sourceSystem, string baseParty, string reportId, DateTime calculationDateTime)
        //{
        //    SetProperties(sourceSystem, baseParty, reportId, calculationDateTime);
        //}

        private void SetProperties(NamedValueSet properties)
        {
            try
            {
                DataType            = "ValuationReport";
                SourceSystem        = PropertyHelper.ExtractSourceSystem(properties);
                Id                  = properties.GetValue <string>(ValueProp.PortfolioId, false);
                TradeId             = properties.GetValue <string>(TradeProp.TradeId, true);
                MarketName          = properties.GetValue <string>(ValueProp.MarketName, false);
                Domain              = SourceSystem + '.' + DataType;
                CalculationDateTime = properties.GetValue <DateTime>("CalculationDateTime");
                BaseParty           = properties.GetValue <string>(ValueProp.BaseParty);
                UniqueIdentifier    = BuildUniqueId();
                if (properties.GetValue <string>(CurveProp.UniqueIdentifier) != null)
                {
                    UniqueIdentifier = properties.GetValue <string>(CurveProp.UniqueIdentifier);
                }
                PropertyHelper.Update(Properties, CurveProp.UniqueIdentifier, UniqueIdentifier);
                PropertyHelper.Update(Properties, "Domain", Domain);
            }
            catch
            {
                throw new System.Exception("Invalid tradeid.");
            }
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IIdentifier"/> class.
 /// </summary>
 /// <param name="properties">The properties. they must include:
 /// PricingStructureType, CurveName, BuildDateTime and Algorithm.</param>
 public AssetConfigurationIdentifier(NamedValueSet properties)
     : base(properties)
 {
     try
     {
         DataType         = "Configuration.Asset";
         SourceSystem     = PropertyHelper.ExtractSourceSystem(properties);
         Domain           = SourceSystem + '.' + DataType;
         Id               = PropertyHelper.ExtractPropertyIdentifier(properties);
         AssetRef         = PropertyHelper.ExtractAssetRef(properties);
         UniqueIdentifier = BuildUniqueId();
         PropertyHelper.Update(Properties, CurveProp.UniqueIdentifier, UniqueIdentifier);
         PropertyHelper.Update(Properties, "Domain", Domain);
     }
     catch (System.Exception)
     {
         throw new System.Exception("Invalid pricingstrucutre property name.");
     }
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IIdentifier"/> class.
 /// </summary>
 /// <param name="properties">The properties. they must include:
 /// PricingStructureType, CurveName, BuildDateTime and Algorithm.</param>
 public PricingStructurePropertiesIdentifier(NamedValueSet properties)
 {
     Properties = properties;
     try
     {
         DataType             = "Properties.PricingStructures";
         SourceSystem         = PropertyHelper.ExtractSourceSystem(properties);
         Domain               = SourceSystem + '.' + DataType;
         Id                   = PropertyHelper.ExtractPropertyIdentifier(properties);
         PricingStructureType = PropertyHelper.ExtractPricingStructureType(properties);
         UniqueIdentifier     = BuildUniqueId();
         PropertyHelper.Update(Properties, CurveProp.UniqueIdentifier, UniqueIdentifier);
         PropertyHelper.Update(Properties, "Domain", Domain);
     }
     catch (System.Exception)
     {
         throw new System.Exception("Invalid pricingstrucutre property name.");
     }
 }
        private void SetProperties()
        {
            SourceSystem         = PropertyHelper.ExtractSourceSystem(Properties);
            PricingStructureType = PropertyHelper.ExtractPricingStructureType(Properties);
            Domain        = SourceSystem + '.' + DataType;
            BuildDateTime = PropertyHelper.ExtractBuildDateTime(Properties);
            BaseDate      = PropertyHelper.ExtractBaseDate(Properties);
            Algorithm     = PropertyHelper.ExtractAlgorithm(Properties);
            Market        = PropertyHelper.ExtractMarket(Properties);
            MarketAndDate = PropertyHelper.ExtractMarketAndDate(Properties);
            Index         = PropertyHelper.ExtractIndex(Properties);
            IndexTenor    = PropertyHelper.ExtractIndexTenor(Properties);
            CurveName     = PropertyHelper.ExtractCurveName(Properties);
            Currency      = CurrencyHelper.Parse(PropertyHelper.ExtractCurrency(Properties));
            DateTime?marketDate = PropertyHelper.ExtractMarketDate(Properties);

            MarketDate       = marketDate ?? MarketDate;
            StressName       = Properties.GetValue <string>(CurveProp.StressName, false);
            NameSpace        = Properties.GetValue <string>(EnvironmentProp.NameSpace, false);
            Id               = BuildId();
            UniqueIdentifier = SetUniqueId();
        }