예제 #1
0
        // Création et initialisation du portefeuille de couverture de l'option
        public HedgingPortfolio createPortfolio(Option option, PricingResults pricingResults, List<DataFeed> dataFeedList, DateTime date)
        {
            System.Collections.Generic.Dictionary<string, double> sharesQuantities = new System.Collections.Generic.Dictionary<string, double>();

            double[] shareSpots = Utilities.shareSpots(dataFeedList, date);
            double portfolioSharesValue = 0;
            for (int i = 0; i < pricingResults.Deltas.Length; i++)
            {
                sharesQuantities.Add(option.UnderlyingShareIds[i], pricingResults.Deltas[i]);
                portfolioSharesValue += pricingResults.Deltas[i] * shareSpots[i];
            }
            double riskFreeRateInvestment = pricingResults.Price - portfolioSharesValue;
            HedgingPortfolio portfolio = new HedgingPortfolio(sharesQuantities, riskFreeRateInvestment);
            return portfolio;
        }
예제 #2
0
        private Dictionary<System.DateTime, ResultValue> computeResults(Option option, HedgingPortfolio portfolio, CompositionProvider compositionProvider, List<DataFeed> dataFeedList, int windowLength, int nbDaysYear, bool isSimulated)
        {
            Dictionary<System.DateTime, ResultValue> plotResults = new Dictionary<System.DateTime, ResultValue>();

            // Rebalancement du portfeuille au cours du temps
            double riskFreeRate = 0;
            for (int i = windowLength; i < dataFeedList.Count() - 2; i++)
            {
                // Calcul du taux sans risque proratisé
                riskFreeRate = Utilities.computeAccruedRiskFreeRate(dataFeedList[i].Date, dataFeedList[i + 1].Date, nbDaysYear, isSimulated);

                // Rebalancement et actualisation de la valeur du portefeuille
                PricingResults pricingResults = compositionProvider.getComposition(dataFeedList, dataFeedList[i].Date, windowLength, nbDaysYear);
                portfolio.update(dataFeedList[i].PriceList, pricingResults.Deltas, riskFreeRate);
                ResultValue curentValue = new ResultValue(pricingResults.Price, portfolio.Value);
                plotResults.Add(dataFeedList[i].Date, curentValue);
            }
            // Calcul du taux sans risque proratisé
            riskFreeRate = Utilities.computeAccruedRiskFreeRate(dataFeedList[dataFeedList.Count() - 2].Date, dataFeedList[dataFeedList.Count() - 1].Date, nbDaysYear, isSimulated);
            // Valeur finale du portefeuille
            portfolio.computeValue(dataFeedList[dataFeedList.Count() - 1].PriceList, riskFreeRate);
            ResultValue finalValue = new ResultValue(option.GetPayoff(dataFeedList.Last().PriceList), portfolio.Value);
            plotResults.Add(dataFeedList.Last().Date, finalValue);

            return plotResults;
        }
예제 #3
0
 public PortfolioEstimator(HedgingPortfolio hedgingPortfolio)
 {
     HedgingPortfolio = hedgingPortfolio;
 }