コード例 #1
0
        // leg initial notional, which is the same for all scenarios
        // package-scoped for testing
        internal LegAmounts legInitialNotional(ResolvedSwapTrade trade)
        {
            IList <Pair <ResolvedSwapLeg, CurrencyAmount> > notionals = trade.Product.Legs.Select(leg => Pair.of(leg, buildLegNotional(leg))).ToList();
            CurrencyAmount firstNotional = notionals.Where(pair => pair.Second != NOT_FOUND).Select(pair => pair.Second).First().orElseThrow(() => new System.ArgumentException("No notional found on any swap leg"));

            notionals = notionals.Select(pair => pair.Second != NOT_FOUND ? pair : Pair.of(pair.First, firstNotional)).ToList();
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            ImmutableList <LegAmount> legAmounts = notionals.Select(pair => SwapLegAmount.of(pair.First, pair.Second)).collect(toImmutableList());

            return(LegAmounts.of(legAmounts));
        }
コード例 #2
0
        // present value for a leg
        private SwapLegAmount legAmount(ResolvedSwapLeg leg, RatesProvider provider)
        {
            CurrencyAmount amount = tradePricer.ProductPricer.LegPricer.presentValue(leg, provider);

            return(SwapLegAmount.of(leg, amount));
        }