Esempio n. 1
0
        public override CompletePricingResults getPricingResults(List <DataFeed> pricingData)
        {
            double[,] underlyingSpots = ConvertDecimalArray.listDataFeedToDoubleArray(pricingData);
            double[]               volatility             = StatComputing.volatilitiesComputing(underlyingSpots);
            Pricer                 pricer                 = new Pricer();
            double                 spot                   = underlyingSpots[underlyingSpots.GetLength(0) - 1, 0];
            PricingResults         pricingResults         = pricer.Price((VanillaCall)opt, pricingData.Last().Date, 365, spot, volatility.First());
            CompletePricingResults completePricingResults = new CompletePricingResults(pricingResults, new double[] { spot });

            return(completePricingResults);
        }
Esempio n. 2
0
        public override CompletePricingResults getPricingResults(List <DataFeed> pricingData)
        {
            double[,] underlyingSpots     = ConvertDecimalArray.listDataFeedToDoubleArray(pricingData);
            double[,] myCorrelationMatrix = StatComputing.correlationMatrix(underlyingSpots);
            double[] volatility = StatComputing.volatilitiesComputing(underlyingSpots);
            Pricer   pricer     = new Pricer();
            int      nShares    = underlyingSpots.GetLength(1);

            double[] spots = new double[nShares];
            for (int i = 0; i < nShares; i++)
            {
                spots[i] = underlyingSpots[nShares - 1, i];
            }
            PricingResults         pricingResults         = pricer.Price((BasketOption)opt, pricingData.Last().Date, 365, spots, volatility, myCorrelationMatrix);;
            CompletePricingResults completePricingResults = new CompletePricingResults(pricingResults, spots);

            return(completePricingResults);
        }