/// <summary> /// Initializes a new instance of the <see cref="PricingStructureIdentifier"/> class. /// </summary> /// <param name="curveId">The curve id.</param> public PricingStructureIdentifier(string curveId) { Properties = new NamedValueSet(); DataType = "Market"; SourceSystem = "Orion"; Domain = SourceSystem + '.' + DataType; BuildDateTime = DateTime.Now; Properties.Set(CurveProp.BuildDateTime, BuildDateTime); Algorithm = "Default"; Id = curveId; Properties.Set("Identifier", Id); Properties.Set(CurveProp.Algorithm, Algorithm); Properties.Set("DataType", "Market"); Properties.Set(CurveProp.SourceSystem, "Orion"); Properties.Set("Domain", SourceSystem + '.' + DataType); string[] idParts = curveId.Split('.'); if (idParts.Length >= 2) { try { PricingStructureType = EnumHelper.Parse <PricingStructureTypeEnum>(idParts[0]); Properties.Set(CurveProp.PricingStructureType, PricingStructureType.ToString()); CurveName = idParts[1]; Properties.Set(CurveProp.CurveName, CurveName); Currency = CurrencyHelper.Parse(PropertyHelper.ExtractCurrency(Properties)); if (idParts.Length >= 3) { BaseDate = DateTime.Parse(idParts[2]); Properties.Set(CurveProp.BaseDate, BaseDate); if (idParts.Length > 3) { Algorithm = idParts[3]; Properties.Set(CurveProp.Algorithm, Algorithm); } } UniqueIdentifier = SetUniqueId(); Properties.Set(CurveProp.UniqueIdentifier, UniqueIdentifier); SetProperties(); } catch (System.Exception ex) { throw new ArgumentException($"Invalid pricingStructureId {curveId} - unable to parse", ex); } } }
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(); }