本文整理汇总了C#中Option.GetPayoff方法的典型用法代码示例。如果您正苦于以下问题:C# Option.GetPayoff方法的具体用法?C# Option.GetPayoff怎么用?C# Option.GetPayoff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Option
的用法示例。
在下文中一共展示了Option.GetPayoff方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: computeResults
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;
}
示例2: sharedMain
public void sharedMain(Option option, CompositionProvider compositionProvider, List<DataFeed> dataFeedList, List<Share> shareList, DateTime initialDate, double strike, DateTime maturity, int windowLength, int numberOfDaysPerYear, bool simulated)
{
PricingResults pricingResults = compositionProvider.getComposition(dataFeedList, initialDate, windowLength, numberOfDaysPerYear);
HedgingPortfolio portfolio = createPortfolio(option, pricingResults, dataFeedList, initialDate);
Dictionary<System.DateTime, ResultValue> plotResults = computeResults(option, portfolio, compositionProvider, dataFeedList, windowLength, numberOfDaysPerYear, !simulated);
// Calcul du PayOff
double payoff = option.GetPayoff(dataFeedList.Last().PriceList);
Console.WriteLine(portfolio.Value);
Console.WriteLine(payoff);
// Création du graphique de résultats
PlotModel = new PlotModel();
SetUpModel();
OptionDescription = "Underlying share: " + Utilities.shareListString(shareList.ToArray()) + "\n Strike: " + strike + "\n Start Date: " + initialDate + "\n Maturity: " + maturity;
// Tracé du plot
DrawPlot(plotResults, payoff);
}