示例#1
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.");
     }
 }
示例#2
0
 /// <summary>
 ///  An id for a trade.
 /// </summary>
 /// <param name="other">THe spread. May be zero.</param>
 /// <param name="properties">The properties. These need to include:
 ///  SourceSystem, Id and Trade date.</param>
 /// <param name="marketQuote">The market quote. This could be a rate or a volatility.</param>
 public AssetIdentifier(Decimal?marketQuote, Decimal?other, NamedValueSet properties)
     : base(properties)
 {
     MarketQuote = marketQuote;
     Other       = other;
     Strike      = PropertyHelper.ExtractDecimalProperty("Strike", properties) ?? other;
     SetProperties(properties);
 }