Exemplo n.º 1
0
        private Func <double[], double> Zc(Zc zc)
        {
            RateZcRepresentation zcRepresentation;

            if (zcRepresentations.TryGetValue(zc.Currency, out zcRepresentation))
            {
                var discountCurve = market.DiscountCurve(zc.FinancingId);
                var fwdZc         = discountCurve.Zc(zc.PayDate) / discountCurve.Zc(zc.Date);
                return(zcRepresentation.Zc(zc.Date, zc.PayDate, fwdZc).Eval);
            }
            throw new Exception(string.Format("Not handled currency {0}", zc.Currency));
        }
        private static Func <double[], double> FlowRebasement(PaymentInfo payment, McModel model)
        {
            var modelMeasure = model.ProbaMeasure;

            if (modelMeasure.Date < payment.Date ||
                !modelMeasure.Currency.Equals(payment.Currency) ||
                !modelMeasure.Financing.Equals(payment.Financing))
            {
                throw new NotImplementedException("Flow Rebasement not yet handled !"); //TODO finish the job !
            }
            var    zc     = new Zc(payment.Date, modelMeasure.Date, payment.Currency, payment.Financing);
            var    zcFunc = model.FactorRepresentation[zc];
            double num0   = model.Numeraire0;

            return(f => num0 / zcFunc(f));
        }