Beispiel #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()
        {
            // 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));
        }
        //-------------------------------------------------------------------------
        /// <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());
        }
Beispiel #4
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));
        }