/// <summary> /// Prepare for valuation anything that is dependent upon the scenario. /// </summary> public override void PreValue(PriceFactorList factors) { base.PreValue(factors); CommodityFuture deal = (CommodityFuture)Deal; fCommodityPrice = factors.GetInterface <ICommodityPrice>(deal.Commodity); }
/// <summary> /// Register price factors. /// </summary> public override void RegisterFactors(PriceFactorList factors, ErrorList errors) { base.RegisterFactors(factors, errors); CommodityFuture deal = (CommodityFuture)Deal; factors.RegisterInterface <ICommodityPrice>(deal.Commodity); }
/// <summary> /// Calculate forward price. /// </summary> protected override void ForwardPrice(double baseDate, double valueDate, Vector forwardPrice) { CommodityFuture deal = (CommodityFuture)Deal; double t = CalcUtils.DaysToYears(valueDate - baseDate); double tSettle = CalcUtils.DaysToYears(deal.Settlement_Date - baseDate); forwardPrice.Assign((fCommodityPrice.ForwardFactor(t, tSettle, fFxRate) * fCommodityPrice.Get(t)) / fFxRate.Get(t)); }