/** * Gets the currency of the event. * <p> * The currency of the event is the currency of the payment. * * @return the currency of the event */ @Override public Currency getCurrency() { return payment.getCurrency(); }
/** * Gets the currency of this payment. * * @return the payment currency */ public Currency getCurrency() { return payment.getCurrency(); }
/** * Gets the currency of the product. * <p> * All payments in the bond will have this currency. * * @return the currency */ public Currency getCurrency() { return nominalPayment.getCurrency(); }
/** * Returns the currency of the bill. * * @return the currency */ public Currency getCurrency() { return notional.getCurrency(); }
@Override public Currency getCurrency() { return payment.getCurrency(); }
/** * Gets currency pair of the base currency and counter currency. * <p> * This currency pair is conventional, thus indifferent to the direction of FX. * * @return the currency pair */ public CurrencyPair getCurrencyPair() { return CurrencyPair.of(baseCurrencyPayment.getCurrency(), counterCurrencyPayment.getCurrency()); }
/** * Gets currency pair of the base currency and counter currency. * <p> * This currency pair is conventional, thus indifferent to the direction of FX. * * @return the currency pair */ @Override public CurrencyPair getCurrencyPair() { return CurrencyPair.of(baseCurrencyPayment.getCurrency(), counterCurrencyPayment.getCurrency()); }
/** * Get the counter currency of the underlying FX transaction. * * @return the counter currency */ public Currency getCounterCurrency() { return underlying.getCounterCurrencyPayment().getCurrency(); }
@ImmutablePreBuild private static void preBuild(Builder builder) { // swap order to be base/counter if reverse is conventional // this handles deserialization where the base/counter rules differ from those applicable at serialization Payment base = builder.baseCurrencyPayment; Payment counter = builder.counterCurrencyPayment; CurrencyPair pair = CurrencyPair.of(counter.getCurrency(), base.getCurrency()); if (pair.isConventional()) { builder.baseCurrencyPayment = counter; builder.counterCurrencyPayment = base; } }
@ImmutablePreBuild private static void preBuild(Builder builder) { // swap order to be base/counter if reverse is conventional // this handled deserialization where the base/counter rules differ from those applicable at serialization Payment base = builder.baseCurrencyPayment; Payment counter = builder.counterCurrencyPayment; CurrencyPair pair = CurrencyPair.of(counter.getCurrency(), base.getCurrency()); if (pair.isConventional()) { builder.baseCurrencyPayment = counter; builder.counterCurrencyPayment = base; } }
@ImmutableValidator private void validate() { if (baseCurrencyPayment.getCurrency().equals(counterCurrencyPayment.getCurrency())) { throw new IllegalArgumentException("Amounts must have different currencies"); } if ((baseCurrencyPayment.getAmount() != 0d || counterCurrencyPayment.getAmount() != 0d) && Math.signum(baseCurrencyPayment.getAmount()) != -Math.signum(counterCurrencyPayment.getAmount())) { throw new IllegalArgumentException("Amounts must have different signs"); } }
@ImmutableValidator private void validate() { if (baseCurrencyPayment.getCurrency().equals(counterCurrencyPayment.getCurrency())) { throw new IllegalArgumentException("Payments must have different currencies"); } if ((baseCurrencyPayment.getAmount() != 0d || counterCurrencyPayment.getAmount() != 0d) && Math.signum(baseCurrencyPayment.getAmount()) != -Math.signum(counterCurrencyPayment.getAmount())) { throw new IllegalArgumentException("Payments must have different signs"); } ArgChecker.inOrderOrEqual(baseCurrencyPayment.getDate(), counterCurrencyPayment.getDate(), "baseCurrencyPayment.date", "counterCurrencyPayment.date"); }
@ImmutableValidator private void validate() { ArgChecker.inOrderNotEqual( nearLeg.getPaymentDate(), farLeg.getPaymentDate(), "nearLeg.paymentDate", "farLeg.paymentDate"); if (!nearLeg.getBaseCurrencyPayment().getCurrency().equals(farLeg.getBaseCurrencyPayment().getCurrency()) || !nearLeg.getCounterCurrencyPayment().getCurrency().equals(farLeg.getCounterCurrencyPayment().getCurrency())) { throw new IllegalArgumentException("Legs must have the same currency pair"); } if (signum(nearLeg.getBaseCurrencyPayment().getAmount()) == signum(farLeg.getBaseCurrencyPayment().getAmount())) { throw new IllegalArgumentException("Legs must have payments flowing in opposite directions"); } }
private static FxSingle create( Payment payment1, Payment payment2, BusinessDayAdjustment paymentDateAdjustment) { ArgChecker.notNull(payment1, "payment1"); ArgChecker.notNull(payment2, "payment2"); CurrencyPair pair = CurrencyPair.of(payment1.getCurrency(), payment2.getCurrency()); if (pair.isConventional()) { return new FxSingle(payment1, payment2, paymentDateAdjustment); } else { return new FxSingle(payment2, payment1, paymentDateAdjustment); } }
public void test_upfrontPayment() { Payment payment = TRADE_PRICER.upfrontPayment(TRADE); assertEquals(payment.getCurrency(), EUR); assertEquals(payment.getAmount(), -NOTIONAL * QUANTITY * DIRTY_PRICE, TOL); assertEquals(payment.getDate(), SETTLEMENT); }
public void test_of() { ResolvedBulletPayment test = ResolvedBulletPayment.of(PAYMENT1); assertEquals(test.getPayment(), PAYMENT1); assertEquals(test.getCurrency(), PAYMENT1.getCurrency()); }
/** * 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_upfrontPayment_position() { Payment payment = TRADE_PRICER.upfrontPayment(POSITION); assertEquals(payment.getCurrency(), EUR); assertEquals(payment.getAmount(), 0, TOL); assertEquals(payment.getDate(), POSITION.getProduct().getStartDate()); }
public void test_explainPresentValue_provider_ended() { ExplainMap explain = PRICER.explainPresentValue(PAYMENT_PAST, PROVIDER); Currency currency = PAYMENT_PAST.getCurrency(); assertEquals(explain.get(ExplainKey.ENTRY_TYPE).get(), "Payment"); assertEquals(explain.get(ExplainKey.PAYMENT_DATE).get(), PAYMENT_PAST.getDate()); assertEquals(explain.get(ExplainKey.PAYMENT_CURRENCY).get(), currency); assertEquals(explain.get(ExplainKey.FORECAST_VALUE).get().getCurrency(), currency); assertEquals(explain.get(ExplainKey.FORECAST_VALUE).get().getAmount(), 0, TOL); assertEquals(explain.get(ExplainKey.PRESENT_VALUE).get().getCurrency(), currency); assertEquals(explain.get(ExplainKey.PRESENT_VALUE).get().getAmount(), 0, TOL); }
public void test_builder() { ResolvedBulletPayment test = ResolvedBulletPayment.builder().payment(PAYMENT1).build(); assertEquals(test.getPayment(), PAYMENT1); assertEquals(test.getCurrency(), PAYMENT1.getCurrency()); }