public string CreateFraTradeValuation(ILogger logger, ICoreCache cache,
                                              IRateCurve forwardCurve, IRateCurve discountCurve,
                                              IBusinessCalendar fixingCalendar, IBusinessCalendar paymentCalendar,
                                              FraInputRange fraInputRange, string[] metrics,
                                              NamedValueSet properties, String nameSpace)
        {
            //get the balues reqired from the property bag.
            var valuationId       = new ValuationReportIdentifier(properties);
            var baseParty         = properties.GetString("BaseParty", true);
            var reportingCurrency = properties.GetString("ReportingCurrency", true);

            properties.Set("Function", "ValuationReport");
            properties.Set("Domain", "Orion.ValuationReport");
            //TODO add other properties
            //var fra = Cache.GetTrade(fraId);
            var fra = ProductFactory.GetFpMLFra(fraInputRange);
            //Get the curves and store.
            var marketFactory = new MarketFactory();
            var uniqueCurves  = new List <IRateCurve>();
            //var forwardCurve = (RateCurve)ObjectCacheHelper.GetPricingStructureFromSerialisable(fraInputRange.ForwardCurveId);
            //var discountCurve = (RateCurve)ObjectCacheHelper.GetPricingStructureFromSerialisable(fraInputRange.DiscountingCurveId);
            var market        = CreateMarket(discountCurve, forwardCurve);
            var agreement     = new FraPricer(logger, cache, null, null, fra, nameSpace);
            var modelData     = CreateInstrumentModelData(metrics, fraInputRange.ValuationDate, market, reportingCurrency);
            var asetValuation = agreement.Calculate(modelData);

            //  Add forward yield curve to the market environment ...
            //
            //var forwardCurve = (IRateCurve)ObjectCacheHelper.GetPricingStructureFromSerialisable(fraInputRange.ForwardCurveId);
            uniqueCurves.Add(forwardCurve);
            //  ... if discount curve is not the same as forward curve - add a discount curve too.
            //
            //if (fraInputRange.ForwardCurveId != fraInputRange.DiscountingCurveId)
            //{
            //    var discountingCurve = (IRateCurve)ObjectCacheHelper.GetPricingStructureFromSerialisable(fraInputRange.DiscountingCurveId);
            //    uniqueCurves.Add(discountingCurve);
            //}
            //TODO Add the FX curve if the reporting currency is different.
            foreach (var rateCurve in uniqueCurves)
            {
                // Add all unique curves into market
                //
                Pair <PricingStructure, PricingStructureValuation> pair = rateCurve.GetFpMLData();
                marketFactory.AddPricingStructure(pair);
            }
            var valuation = new Valuation();

            //  create ValuationReport and add it to in-memory collection.
            //
            valuation.CreateFraValuationReport(cache, nameSpace, valuationId.UniqueIdentifier, baseParty, fra, marketFactory.Create(), asetValuation, properties);
            return(valuationId.UniqueIdentifier);
        }
        /// <summary>
        /// Prices the product.
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="cache"></param>
        /// <param name="fixingCalendar"></param>
        /// <param name="paymentCalendar"></param>
        /// <param name="fra"></param>
        /// <param name="valuationDate"></param>
        /// <param name="market"></param>
        /// <param name="nameSpace"></param>
        /// <returns></returns>
        public static double GetParRate(ILogger logger, ICoreCache cache,
                                        IBusinessCalendar fixingCalendar,
                                        IBusinessCalendar paymentCalendar,
                                        Fra fra,
                                        DateTime valuationDate,
                                        IMarketEnvironment market,
                                        String nameSpace)
        {
            var agreement = new FraPricer(logger, cache, fixingCalendar, paymentCalendar, fra, nameSpace);
            var modelData = CreateInstrumentModelData(new[] { "ImpliedQuote" }, valuationDate, market, "AUD");
            var av        = agreement.Calculate(modelData);

            return((double)av.quote[0].value);
        }