/// <summary> /// Set the Filler Strategy to Custom Value /// </summary> /// <param name="marketAssessmentValue"></param> /// <returns>MasQuery</returns> public MasQuery WithFillCustomValue(MarketAssessmentValue marketAssessmentValue) { _queryParamaters.FillerKindType = FillerKindType.CustomValue; _queryParamaters.FillerConfig.FillerMasDV = marketAssessmentValue; return(this); }
/// <summary> /// MarketAssessment AddData /// </summary> /// <remarks> /// Add Data on to the curve with Instant /// </remarks> /// <returns>AddAssessmentOperationResult</returns> public AddAssessmentOperationResult AddData(Instant time, string product, MarketAssessmentValue value) { if (!_entity.OriginalGranularity.IsTimeGranularity()) { throw new MarketAssessmentException("This MarketData has Date granularity. Use AddData(LocalDate date...)"); } return(_addAssessment(time.InUtc().LocalDateTime, product, value)); }
private AddAssessmentOperationResult _addAssessment(LocalDateTime reportTime, string product, MarketAssessmentValue value) { //Relative products if (Regex.IsMatch(product, @"\+\d+$")) { throw new NotSupportedException("Relative Products are not supported"); } if (_entity.OriginalGranularity.IsTimeGranularity()) { var period = ArtesianUtils.MapTimePeriod(_entity.OriginalGranularity); if (!reportTime.IsStartOfInterval(period)) { throw new MarketAssessmentException("Trying to insert Report Time {0} with the wrong format to Assessment {1}. Should be of period {2}", reportTime, _identifier, period); } } else { var period = ArtesianUtils.MapDatePeriod(_entity.OriginalGranularity); if (!reportTime.IsStartOfInterval(period)) { throw new MarketAssessmentException("Trying to insert Report Time {0} with wrong the format to Assessment {1}. Should be of period {2}", reportTime, _identifier, period); } } //if (reportTime.Date >= product.ReferenceDate) // return AddAssessmentOperationResult.IllegalReferenceDate; if (Assessments.Any(row => row.ReportTime == reportTime && row.Product.Equals(product))) { return(AddAssessmentOperationResult.ProductAlreadyPresent); } Assessments.Add(new AssessmentElement(reportTime, product, value)); return(AddAssessmentOperationResult.AssessmentAdded); }
/// <summary> /// MarketAssessment AddData /// </summary> /// <remarks> /// Add Data on to the curve with localDate /// </remarks> /// <returns>AddAssessmentOperationResult</returns> public AddAssessmentOperationResult AddData(LocalDate localDate, string product, MarketAssessmentValue value) { if (_entity.OriginalGranularity.IsTimeGranularity()) { throw new MarketAssessmentException("This MarketData has Time granularity. Use AddData(Instant time...)"); } return(_addAssessment(localDate.AtMidnight(), product, value)); }
/// <summary> /// AssessmentElement constructor /// </summary> public AssessmentElement(LocalDateTime reportTime, string product, MarketAssessmentValue value) { ReportTime = reportTime; Product = product; Value = value; }