コード例 #1
0
        public void ComputePathFlows(ref PathFlows <double, CouponFlowLabel> pathFlows,
                                     PathFlows <double[], IFixing[]> fixingsPath,
                                     PathFlows <double[], PaymentInfo[]> flowRebasementPath)
        {
            double[][] fixings     = fixingsPath.Flows;
            double[][] rebasements = flowRebasementPath.Flows;

            double[] autocallFlows = pathFlows.Flows;
            for (int i = 0; i < autocallFlows.Length; i++)
            {
                autocallFlows[i] = 0.0;
            }

            int callIndex          = CallIndex(fixings);
            int lastPayCouponIndex = (callIndex < underlyingCallIndexes.Length)
                ? underlyingCallIndexes[callIndex]
                : underlyingPathFlows.Length;

            for (int i = 0; i < lastPayCouponIndex; i++)
            {
                autocallFlows[i] = underlyingPathFlows[i].FlowValue(fixings, rebasements);
            }

            if (callIndex < redemptionPathFlows.Length)
            {
                autocallFlows[underlyingPathFlows.Length + callIndex] = redemptionPathFlows[callIndex].FlowValue(fixings, rebasements);
            }
        }
コード例 #2
0
ファイル: McPricer.cs プロジェクト: xyicheng/pragmatic-quant
        public IPricingResult Price(IProduct product, IModel model, Market market)
        {
            var     simulatedDates = product.RetrieveEventDates();
            McModel mcModel        = mcModelFactory.Build(model, market, simulatedDates);
            var     mcEngine       = McEngine(product, mcModel);

            PathFlows <double, CouponFlowLabel> result = mcEngine.Run(nbPaths);

            return(pricingResult.PricingResult(result, product, market));
        }
コード例 #3
0
        public ProductPathFlowCalculator(IPathFlowCalculator <double[], IFixing[]> fixingPathCalculator,
                                         IPathFlowCalculator <double[], PaymentInfo[]> numerairePathCalc,
                                         IProductPathFlow productPathFlow)
        {
            this.fixingPathCalculator = fixingPathCalculator;
            this.numerairePathCalc    = numerairePathCalc;
            this.productPathFlow      = productPathFlow;

            //Buffers initialization
            fixingsPath   = fixingPathCalculator.NewPathFlow();
            numerairePath = numerairePathCalc.NewPathFlow();
        }
コード例 #4
0
        public void ComputePathFlows(ref PathFlows <double, CouponFlowLabel> pathFlows,
                                     PathFlows <double[], IFixing[]> fixingsPath,
                                     PathFlows <double[], PaymentInfo[]> flowRebasementPath)
        {
            double[][] fixings     = fixingsPath.Flows;
            double[][] rebasements = flowRebasementPath.Flows;

            double[] couponsFlows = pathFlows.Flows;
            for (int i = 0; i < couponPathFlows.Length; i++)
            {
                couponsFlows[i] = couponPathFlows[i].FlowValue(fixings, rebasements);
            }
        }
コード例 #5
0
 public void ComputeFlows(ref PathFlows <double, CouponFlowLabel> pathFlows, IProcessPath processPath)
 {
     fixingPathCalculator.ComputeFlows(ref fixingsPath, processPath);
     numerairePathCalc.ComputeFlows(ref numerairePath, processPath);
     productPathFlow.ComputePathFlows(ref pathFlows, fixingsPath, numerairePath);
 }