コード例 #1
0
        public static double ConvertCcy(this IMarketCondition market, Date date, double amount, CurrencyCode fromCcy, CurrencyCode toCcy)
        {
            if (fromCcy == toCcy)
            {
                return(amount);
            }

            return(amount * market.GetFxRate(date, fromCcy, toCcy));
        }
コード例 #2
0
        public override IPricingResult Calculate(FxOption fxOption, IMarketCondition market, PricingRequest request)
        {
            var newMarket = market.UpdateCondition(
                new UpdateMktConditionPack <IYieldCurve>(x => x.DividendCurves, market.FgnDiscountCurve.Value),
                new UpdateMktConditionPack <double>(x => x.SpotPrices.Value.Values.First(), market.GetFxRate(GetSpotDate(market.ValuationDate, fxOption), fxOption.DomCcy, fxOption.FgnCcy))
                );

            return(new AnalyticalVanillaEuropeanOptionEngine().Calculate(fxOption, newMarket, request));
        }