示例#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
 private void SetProperties(NamedValueSet properties)
 {
     try
     {
         var baseDate = PropertyHelper.ExtractDateTimeProperty(CurveProp.BaseDate, properties);
         if (baseDate != null)
         {
             BaseDate = (DateTime)baseDate;
         }
         Id = PropertyHelper.ExtractStringProperty("AssetId", properties);
         //AssetType property - make sure it exists.
         var assetType = PropertyHelper.ExtractStringProperty("AssetType", properties);
         if (assetType != null)
         {
             AssetType = EnumHelper.Parse <AssetTypesEnum>(assetType);
         }
         Coupon           = PropertyHelper.ExtractDecimalProperty("Coupon", properties);
         MaturityDate     = PropertyHelper.ExtractDateTimeProperty("Maturity", properties);
         UniqueIdentifier = properties.GetValue <string>(CurveProp.UniqueIdentifier) ?? BuildUniqueId();
         PropertyHelper.Update(Properties, CurveProp.UniqueIdentifier, UniqueIdentifier);
     }
     catch
     {
         throw new System.Exception("Invalid assetid.");
     }
 }
示例#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 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.");
     }
 }
示例#5
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.");
     }
 }