Example #1
0
        //-------------------------------------------------------------------------
        public override PortfolioItemSummary summarize()
        {
            // ID x 200
            string description = SecurityId.StandardId.Value + " x " + SummarizerUtils.value(Quantity);

            return(SummarizerUtils.summary(this, ProductType.BOND_FUTURE_OPTION, description, 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()
        {
            string   description = "CDS Index calibration trade";
            Currency currency    = underlyingTrade.Product.Currency;

            return(SummarizerUtils.summary(this, ProductType.CALIBRATION, description, currency));
        }
Example #4
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));
        }
Example #5
0
        //-------------------------------------------------------------------------
        public override PortfolioItemSummary summarize()
        {
            // AAPL x 200
            string description = SecurityId.StandardId.Value + " x " + SummarizerUtils.value(Quantity);

            return(SummarizerUtils.summary(this, ProductType.SECURITY, description, Currency));
        }
Example #6
0
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // F-ECAG-FGBS-201706 x 200, Jun17
            string future      = security.summaryDescription();
            string description = SecurityId.StandardId.Value + " x " + SummarizerUtils.value(Quantity) + ", " + future;

            return(SummarizerUtils.summary(this, ProductType.ETD_FUTURE, description, Currency));
        }
Example #7
0
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // O-ECAG-OGBS-201706-P1.50 x 200, Jun17 P1.50
            string option      = security.summaryDescription();
            string description = SecurityId.StandardId.Value + " x " + SummarizerUtils.value(Quantity) + ", " + option;

            return(SummarizerUtils.summary(this, ProductType.ETD_OPTION, description, Currency));
        }
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // Pay USD 2mm : 21Jan18
            StringBuilder buf = new StringBuilder(64);

            buf.Append(product.PayReceive);
            buf.Append(' ');
            buf.Append(SummarizerUtils.amount(product.Value));
            buf.Append(" : ");
            buf.Append(SummarizerUtils.date(product.Date.Unadjusted));
            return(SummarizerUtils.summary(this, ProductType.BULLET_PAYMENT, buf.ToString(), product.Currency));
        }
Example #9
0
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // Pay USD 1mm @ GBP/USD 1.32 : 21Jan18
            StringBuilder  buf     = new StringBuilder(64);
            CurrencyAmount @base   = product.BaseCurrencyAmount;
            CurrencyAmount counter = product.CounterCurrencyAmount;

            buf.Append(SummarizerUtils.fx(@base, counter));
            buf.Append(" : ");
            buf.Append(SummarizerUtils.date(product.PaymentDate));
            return(SummarizerUtils.summary(this, ProductType.FX_SINGLE, buf.ToString(), @base.Currency, counter.Currency));
        }
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // Pay USD 1mm @ USD/CNY 6.62 NDF : 21Jan18
            StringBuilder  buf      = new StringBuilder(64);
            CurrencyAmount notional = product.SettlementCurrencyNotional;
            CurrencyAmount counter  = notional.convertedTo(product.NonDeliverableCurrency, product.AgreedFxRate);

            buf.Append(SummarizerUtils.fx(notional, counter));
            buf.Append(" NDF : ");
            buf.Append(SummarizerUtils.date(product.PaymentDate));
            return(SummarizerUtils.summary(this, ProductType.FX_NDF, buf.ToString(), product.SettlementCurrency, product.NonDeliverableCurrency));
        }
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // Long 5Y USD 2mm Rec USD-LIBOR-6M / Pay 1% : 21Jan18
            string swapDesc = product.Underlying.summaryDescription();

            swapDesc = swapDesc.Contains(":") ? swapDesc.Substring(0, swapDesc.LastIndexOf(':')).Trim() : swapDesc;
            StringBuilder buf = new StringBuilder(96);

            buf.Append(product.LongShort);
            buf.Append(' ');
            buf.Append(swapDesc);
            buf.Append(" : ");
            buf.Append(SummarizerUtils.date(product.ExpiryDate.Unadjusted));
            return(SummarizerUtils.summary(this, ProductType.SWAPTION, buf.ToString(), product.Currency));
        }
Example #12
0
 // summarize the main leg
 private void summarizeMainLeg(IborCapFloorLeg mainLeg, StringBuilder buf)
 {
     buf.Append(mainLeg.Index);
     buf.Append(' ');
     if (mainLeg.CapSchedule.Present)
     {
         buf.Append("Cap ");
         buf.Append(SummarizerUtils.percent(mainLeg.CapSchedule.get().InitialValue));
     }
     if (mainLeg.FloorSchedule.Present)
     {
         buf.Append("Floor ");
         buf.Append(SummarizerUtils.percent(mainLeg.FloorSchedule.get().InitialValue));
     }
 }
        //-------------------------------------------------------------------------
        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));
        }
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            // Long Barrier Pay USD 1mm Premium USD 100k @ GBP/USD 1.32 : 21Jan18
            StringBuilder  buf     = new StringBuilder(96);
            CurrencyAmount @base   = product.UnderlyingOption.Underlying.BaseCurrencyAmount;
            CurrencyAmount counter = product.UnderlyingOption.Underlying.CounterCurrencyAmount;

            buf.Append(product.UnderlyingOption.LongShort);
            buf.Append(" Barrier ");
            buf.Append(SummarizerUtils.fx(@base, counter));
            buf.Append(" Premium ");
            buf.Append(SummarizerUtils.amount(premium.Value.mapAmount(v => Math.Abs(v))));
            buf.Append(" : ");
            buf.Append(SummarizerUtils.date(product.UnderlyingOption.ExpiryDate));
            CurrencyPair currencyPair = product.CurrencyPair;

            return(SummarizerUtils.summary(this, ProductType.FX_SINGLE_BARRIER_OPTION, buf.ToString(), currencyPair.Base, currencyPair.Counter));
        }
Example #15
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));
        }
Example #16
0
        // a summary of the leg
        private string legSummary(SwapLeg leg)
        {
            if (leg is RateCalculationSwapLeg)
            {
                RateCalculationSwapLeg rcLeg       = (RateCalculationSwapLeg)leg;
                RateCalculation        calculation = rcLeg.Calculation;
                if (calculation is FixedRateCalculation)
                {
                    FixedRateCalculation calc = (FixedRateCalculation)calculation;
                    string vary = calc.Rate.Steps.Count > 0 || calc.Rate.StepSequence.Present ? " variable" : "";
                    return(SummarizerUtils.percent(calc.Rate.InitialValue) + vary);
                }
                if (calculation is IborRateCalculation)
                {
                    IborRateCalculation calc = (IborRateCalculation)calculation;
                    string gearing           = calc.Gearing.map(g => " * " + SummarizerUtils.value(g.InitialValue)).orElse("");
                    string spread            = calc.Spread.map(s => " + " + SummarizerUtils.percent(s.InitialValue)).orElse("");
                    return(calc.Index.Name + gearing + spread);
                }
                if (calculation is OvernightRateCalculation)
                {
                    OvernightRateCalculation calc = (OvernightRateCalculation)calculation;
                    string avg     = calc.AccrualMethod == OvernightAccrualMethod.AVERAGED ? " avg" : "";
                    string gearing = calc.Gearing.map(g => " * " + SummarizerUtils.value(g.InitialValue)).orElse("");
                    string spread  = calc.Spread.map(s => " + " + SummarizerUtils.percent(s.InitialValue)).orElse("");
                    return(calc.Index.Name + avg + gearing + spread);
                }
                if (calculation is InflationRateCalculation)
                {
                    InflationRateCalculation calc = (InflationRateCalculation)calculation;
                    string gearing = calc.Gearing.map(g => " * " + SummarizerUtils.value(g.InitialValue)).orElse("");
                    return(calc.Index.Name + gearing);
                }
            }
            if (leg is KnownAmountSwapLeg)
            {
                KnownAmountSwapLeg kaLeg = (KnownAmountSwapLeg)leg;
                string             vary  = kaLeg.Amount.Steps.Count > 0 || kaLeg.Amount.StepSequence.Present ? " variable" : "";
                return(SummarizerUtils.amount(kaLeg.Currency, kaLeg.Amount.InitialValue) + vary);
            }
            ImmutableSet <Index> allIndices = leg.allIndices();

            return(allIndices.Empty ? "Fixed" : allIndices.ToString());
        }
Example #17
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());
        }
Example #18
0
 // the notional, with trailing space if present
 private string notional(SwapLeg leg)
 {
     if (leg is RateCalculationSwapLeg)
     {
         RateCalculationSwapLeg rcLeg            = (RateCalculationSwapLeg)leg;
         NotionalSchedule       notionalSchedule = rcLeg.NotionalSchedule;
         ValueSchedule          amount           = notionalSchedule.Amount;
         double   notional = amount.InitialValue;
         string   vary     = amount.Steps.Count > 0 || amount.StepSequence.Present ? " variable" : "";
         Currency currency = notionalSchedule.FxReset.map(fxr => fxr.ReferenceCurrency).orElse(rcLeg.Currency);
         return(SummarizerUtils.amount(currency, notional) + vary);
     }
     if (leg is RatePeriodSwapLeg)
     {
         RatePeriodSwapLeg rpLeg = (RatePeriodSwapLeg)leg;
         return(SummarizerUtils.amount(rpLeg.PaymentPeriods.get(0).NotionalAmount));
     }
     return("");
 }
Example #19
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));
        }
Example #20
0
        //-------------------------------------------------------------------------
        public PortfolioItemSummary summarize()
        {
            string description = "Ibor calibration trade";

            return(SummarizerUtils.summary(this, ProductType.CALIBRATION, description, product.Currency));
        }