/// <summary> /// Adds the greek value to the map of greek values by category value. /// </summary> /// <param name="rangeValue"> the category value used in the aggregation.</param> /// <param name="typeOfGreek"> the greek type like delta, gamma, vega, theta.</param> /// <param name="greekValue"> the aggregated total greek value for the specified category value.</param> /// <exception cref="ArgumentException"> if the category value is null or empty.</exception> public void AddOutputExtrapolation(string rangeValue, GreeksEnum typeOfGreek, double greekValue) { if (String.IsNullOrEmpty(rangeValue)) { throw new ArgumentException("rangeValue"); } // Cannot do conversion from Double to Decimal if NAN. if (double.IsNaN(greekValue)) { return; } if (OutputExtrapolation.ContainsKey(typeOfGreek.ToString())) { var greekEntry = OutputExtrapolation[typeOfGreek.ToString()]; greekEntry[rangeValue] = Convert.ToDecimal(greekValue); } else { OutputExtrapolation.Add(typeOfGreek.ToString(), new Dictionary <string, decimal>() { { rangeValue, Convert.ToDecimal(greekValue) } }); } }
/// <summary> /// Adds the greek value to the map of greek values by category value. /// </summary> /// <param name="categoryValue"> the category value used in the aggregation.</param> /// <param name="typeOfGreek"> the greek type like delta, gamma, vega, theta.</param> /// <param name="greekValue"> the aggregated total greek value for the specified category value.</param> /// <exception cref="ArgumentException"> if the category value is null or empty.</exception> public void AddGreek(string categoryValue, GreeksEnum typeOfGreek, double greekValue) { if (String.IsNullOrEmpty(categoryValue)) { throw new ArgumentException("categoryValue"); } if (GreeksByCategory.ContainsKey(typeOfGreek.ToString())) { var greekEntry = GreeksByCategory[typeOfGreek.ToString()]; greekEntry[categoryValue] = Convert.ToDecimal(greekValue); } else { GreeksByCategory.Add(typeOfGreek.ToString(), new Dictionary <string, decimal>() { { categoryValue, Convert.ToDecimal(greekValue) } }); } }