/** * Gets the payment amount. * * @return the payment amount */ public CurrencyAmount getPaymentAmount() { return payment.getValue(); }
/** * Gets the amount in the base currency, positive if receiving, negative if paying. * <p> * The amount is signed. * A positive amount indicates the payment is to be received. * A negative amount indicates the payment is to be paid. * * @return the amount */ public CurrencyAmount getBaseCurrencyAmount() { return baseCurrencyPayment.getValue(); }
/** * Gets the amount in the counter currency, positive if receiving, negative if paying. * <p> * The amount is signed. * A positive amount indicates the payment is to be received. * A negative amount indicates the payment is to be paid. * * @return the amount */ public CurrencyAmount getCounterCurrencyAmount() { return counterCurrencyPayment.getValue(); }
/** * Gets the currency amount in which the amount is paid. * <p> * This returns the currency amount whose amount is negative or zero. * * @return the pay currency amount */ public CurrencyAmount getPayCurrencyAmount() { if (baseCurrencyPayment.getAmount() <= 0d) { return baseCurrencyPayment.getValue(); } return counterCurrencyPayment.getValue(); }
/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(Payment beanToCopy) { this.value = beanToCopy.getValue(); this.date = beanToCopy.getDate(); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 111972721: // value return ((Payment) bean).getValue(); case 3076014: // date return ((Payment) bean).getDate(); } return super.propertyGet(bean, propertyName, quiet); }
/** * Obtains an instance based on a {@code Payment}. * * @param payment the fixed payment * @return the adjustable payment instance */ public static AdjustablePayment of(Payment payment) { return of(payment.getValue(), payment.getDate()); }
@Override public NotionalExchange adjustPaymentDate(TemporalAdjuster adjuster) { LocalDate adjusted = payment.getDate().with(adjuster); return of(payment.getValue(), adjusted); }
public void test_currentCash_valuationAtSettlement() { CurrencyAmount ccComputed = TRADE_PRICER.currentCash(TRADE, SETTLEMENT); assertEquals(ccComputed, UPFRONT_PAYMENT.getValue()); }
/** * Calculates the current cash. * * @param fx the product * @param valuationDate the valuation date * @return the current cash */ public MultiCurrencyAmount currentCash(ResolvedFxSingle fx, LocalDate valuationDate) { if (valuationDate.isEqual(fx.getPaymentDate())) { return MultiCurrencyAmount.of(fx.getBaseCurrencyPayment().getValue(), fx.getCounterCurrencyPayment().getValue()); } return MultiCurrencyAmount.empty(); }
/** * Calculates the current cash. * * @param payment the payment * @param provider the provider * @return the current cash */ public CurrencyAmount currentCash(Payment payment, BaseProvider provider) { if (payment.getDate().isEqual(provider.getValuationDate())) { return payment.getValue(); } return CurrencyAmount.zero(payment.getCurrency()); }
public void test_currentCash_secondPayment() { MultiCurrencyAmount computed = PRICER.currentCash(SWAP_PRODUCT, PAYMENT_DATE_FAR); assertEquals(computed, MultiCurrencyAmount.of( SWAP_PRODUCT.getFarLeg().getBaseCurrencyPayment().getValue(), SWAP_PRODUCT.getFarLeg().getCounterCurrencyPayment().getValue())); }
public void test_currentCash_firstPayment() { MultiCurrencyAmount computed = PRICER.currentCash(SWAP_PRODUCT, PAYMENT_DATE_NEAR); assertEquals(computed, MultiCurrencyAmount.of( SWAP_PRODUCT.getNearLeg().getBaseCurrencyPayment().getValue(), SWAP_PRODUCT.getNearLeg().getCounterCurrencyPayment().getValue())); }
public void test_currentCash() { MultiCurrencyAmount cc1 = TRADE_PRICER.currentCash(CMS_TRADE_PREMIUM, RATES_PROVIDER); MultiCurrencyAmount cc2 = TRADE_PRICER.currentCash(CMS_TRADE, RATES_PROVIDER); assertEquals(cc1, MultiCurrencyAmount.of(PREMIUM.getValue())); assertEquals(cc2, MultiCurrencyAmount.of(CurrencyAmount.zero(EUR))); }
public void test_currentCash() { MultiCurrencyAmount computedWithPayLeg = PRICER.currentCash(TRADE_PAYLEG, RATES, VOLS); MultiCurrencyAmount computedWithPremium = PRICER.currentCash(TRADE_PREMIUM, RATES, VOLS); assertEquals(computedWithPayLeg, MultiCurrencyAmount.of(CurrencyAmount.zero(EUR))); assertEquals(computedWithPremium, MultiCurrencyAmount.of(PREMIUM.getValue())); }
public void test_currentCash() { MultiCurrencyAmount computedWithPayLeg = PRICER.currentCash(TRADE_PAYLEG, RATES, VOLS); MultiCurrencyAmount computedWithPremium = PRICER.currentCash(TRADE_PREMIUM, RATES, VOLS); assertEquals(computedWithPayLeg, MultiCurrencyAmount.of(CurrencyAmount.zero(EUR))); assertEquals(computedWithPremium, MultiCurrencyAmount.of(PREMIUM.getValue())); }
public void test_currentCash() { MultiCurrencyAmount cc1 = TRADE_PRICER.currentCash(CMS_TRADE_PREMIUM, RATES_PROVIDER, VOLATILITIES); MultiCurrencyAmount cc2 = TRADE_PRICER.currentCash(CMS_TRADE, RATES_PROVIDER, VOLATILITIES); assertEquals(cc1, MultiCurrencyAmount.of(PREMIUM.getValue())); assertEquals(cc2, MultiCurrencyAmount.of(CurrencyAmount.zero(EUR))); }
public void test_currentCash() { MultiCurrencyAmount computedWithPayLeg = PRICER.currentCash(TRADE_PAYLEG, RATES, VOLS); MultiCurrencyAmount computedWithPremium = PRICER.currentCash(TRADE_PREMIUM, RATES, VOLS); assertEquals(computedWithPayLeg, MultiCurrencyAmount.of(CurrencyAmount.zero(EUR))); assertEquals(computedWithPremium, MultiCurrencyAmount.of(PREMIUM.getValue())); }
public void test_of_rate_bothZero() { ResolvedFxSingle test = ResolvedFxSingle.of(CurrencyAmount.zero(GBP), FxRate.of(USD, GBP, 1.6d), DATE_2015_06_30); assertEquals(test.getBaseCurrencyPayment().getValue(), CurrencyAmount.zero(GBP)); assertEquals(test.getCounterCurrencyPayment().getValue().getAmount(), CurrencyAmount.zero(USD).getAmount(), 1e-12); assertEquals(test.getPaymentDate(), DATE_2015_06_30); assertEquals(test.getCurrencyPair(), CurrencyPair.of(GBP, USD)); assertEquals(test.getReceiveCurrencyAmount(), CurrencyAmount.of(USD, 0d)); }