Esempio n. 1
0
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // 5Y USD 2mm Rec USD-LIBOR-6M Cap 1% / Pay Premium : 21Jan17-21Jan22
            StringBuilder   buf     = new StringBuilder(96);
            IborCapFloorLeg mainLeg = product.CapFloorLeg;

            buf.Append(SummarizerUtils.datePeriod(mainLeg.StartDate.Unadjusted, mainLeg.EndDate.Unadjusted));
            buf.Append(' ');
            buf.Append(SummarizerUtils.amount(mainLeg.Currency, mainLeg.Notional.InitialValue));
            buf.Append(' ');
            if (mainLeg.PayReceive.Receive)
            {
                buf.Append("Rec ");
                summarizeMainLeg(mainLeg, buf);
                buf.Append(Premium.Present ? " / Pay Premium" : (product.PayLeg.Present ? " /  Pay Periodic" : ""));
            }
            else
            {
                buf.Append(Premium.Present ? "Rec Premium / Pay " : (product.PayLeg.Present ? "Rec Periodic / Pay " : ""));
                summarizeMainLeg(mainLeg, buf);
            }
            buf.Append(" : ");
            buf.Append(SummarizerUtils.dateRange(mainLeg.StartDate.Unadjusted, mainLeg.EndDate.Unadjusted));
            return(SummarizerUtils.summary(this, ProductType.IBOR_CAP_FLOOR, buf.ToString(), mainLeg.Currency));
        }
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // 3x6 USD 1mm Rec GBP-LIBOR / Pay 2.5% : 21Jan18-21Apr18
            StringBuilder        buf       = new StringBuilder(64);
            Optional <LocalDate> tradeDate = info.TradeDate;

            if (tradeDate.Present)
            {
                // use a three day fudge to avoid most holiday and end of month issues when calculating months
                buf.Append(MONTHS.between(tradeDate.get(), product.StartDate.plusDays(3)));
                buf.Append("x");
                buf.Append(MONTHS.between(tradeDate.get(), product.EndDate.plusDays(3)));
            }
            else
            {
                buf.Append(product.Index.Tenor);
            }
            buf.Append(' ');
            string floatingRate = product.Index.FloatingRateName.normalized().ToString();
            string fixedRate    = SummarizerUtils.percent(product.FixedRate);

            buf.Append(SummarizerUtils.amount(product.Currency, product.Notional));
            buf.Append(" Rec ");
            buf.Append(product.BuySell.Buy ? floatingRate : fixedRate);
            buf.Append(" / Pay ");
            buf.Append(product.BuySell.Buy ? fixedRate : floatingRate);
            buf.Append(" : ");
            buf.Append(SummarizerUtils.dateRange(product.StartDate, product.EndDate));
            return(SummarizerUtils.summary(this, ProductType.FRA, buf.ToString(), product.Currency));
        }
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // 6M USD 2mm Deposit 0.8% :  21Jan18-21Jul18
            StringBuilder buf = new StringBuilder(64);

            buf.Append(SummarizerUtils.datePeriod(product.StartDate, product.EndDate));
            buf.Append(' ');
            buf.Append(SummarizerUtils.amount(product.Currency, product.Notional));
            buf.Append(' ');
            buf.Append(product.BuySell == BuySell.BUY ? "Deposit " : "Loan ");
            buf.Append(SummarizerUtils.percent(product.Rate));
            buf.Append(" : ");
            buf.Append(SummarizerUtils.dateRange(product.StartDate, product.EndDate));
            return(SummarizerUtils.summary(this, ProductType.TERM_DEPOSIT, buf.ToString(), product.Currency));
        }
Esempio n. 4
0
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // Pay USD 1mm @ GBP/USD 1.32 : Rec USD 1mm @ GBP/USD 1.35 : 21Jan18-21Apr18
            StringBuilder  buf      = new StringBuilder(96);
            CurrencyAmount base1    = product.NearLeg.BaseCurrencyAmount;
            CurrencyAmount counter1 = product.NearLeg.CounterCurrencyAmount;
            CurrencyAmount base2    = product.FarLeg.BaseCurrencyAmount;
            CurrencyAmount counter2 = product.FarLeg.CounterCurrencyAmount;

            buf.Append(SummarizerUtils.fx(base1, counter1));
            buf.Append(" / ");
            buf.Append(SummarizerUtils.fx(base2, counter2));
            buf.Append(" : ");
            buf.Append(SummarizerUtils.dateRange(product.NearLeg.PaymentDate, product.FarLeg.PaymentDate));
            CurrencyPair currencyPair = product.NearLeg.CurrencyPair;

            return(SummarizerUtils.summary(this, ProductType.FX_SWAP, buf.ToString(), currencyPair.Base, currencyPair.Counter));
        }
Esempio n. 5
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Summarizes this swap into string form.
        /// </summary>
        /// <returns> the summary description </returns>
        public string summaryDescription()
        {
            // 5Y USD 2mm Rec USD-LIBOR-6M / Pay 1% : 21Jan17-21Jan22
            StringBuilder buf = new StringBuilder(64);

            buf.Append(SummarizerUtils.datePeriod(StartDate.Unadjusted, EndDate.Unadjusted));
            buf.Append(' ');
            if (Legs.size() == 2 && PayLeg.Present && ReceiveLeg.Present && Legs.All(leg => leg is RateCalculationSwapLeg))
            {
                // normal swap
                SwapLeg payLeg      = PayLeg.get();
                SwapLeg recLeg      = ReceiveLeg.get();
                string  payNotional = notional(payLeg);
                string  recNotional = notional(recLeg);
                if (payNotional.Equals(recNotional))
                {
                    buf.Append(recNotional);
                    buf.Append(" Rec ");
                    buf.Append(legSummary(recLeg));
                    buf.Append(" / Pay ");
                    buf.Append(legSummary(payLeg));
                }
                else
                {
                    buf.Append("Rec ");
                    buf.Append(legSummary(recLeg));
                    buf.Append(' ');
                    buf.Append(recNotional);
                    buf.Append(" / Pay ");
                    buf.Append(legSummary(payLeg));
                    buf.Append(' ');
                    buf.Append(payNotional);
                }
            }
            else
            {
                // abnormal swap
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
                buf.Append(Legs.Select(leg => (SummarizerUtils.payReceive(leg.PayReceive) + " " + legSummary(leg) + " " + notional(leg)).Trim()).collect(joining(" / ")));
            }
            buf.Append(" : ");
            buf.Append(SummarizerUtils.dateRange(StartDate.Unadjusted, EndDate.Unadjusted));
            return(buf.ToString());
        }
Esempio n. 6
0
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // 2Y Buy USD 1mm INDEX / 1.5% : 21Jan18-21Jan20
            PeriodicSchedule paymentSchedule = product.PaymentSchedule;
            StringBuilder    buf             = new StringBuilder(96);

            buf.Append(SummarizerUtils.datePeriod(paymentSchedule.StartDate, paymentSchedule.EndDate));
            buf.Append(' ');
            buf.Append(product.BuySell);
            buf.Append(' ');
            buf.Append(SummarizerUtils.amount(product.Currency, product.Notional));
            buf.Append(' ');
            buf.Append(product.CdsIndexId.Value);
            buf.Append(" / ");
            buf.Append(SummarizerUtils.percent(product.FixedRate));
            buf.Append(" : ");
            buf.Append(SummarizerUtils.dateRange(paymentSchedule.StartDate, paymentSchedule.EndDate));
            return(SummarizerUtils.summary(this, ProductType.CDS_INDEX, buf.ToString(), product.Currency));
        }