private FixedRateStubCalculation parseStubCalculationForFixed(XmlElement baseEl, FpmlDocument document) { Optional<XmlElement> rateOptEl = baseEl.findChild("stubRate"); if (rateOptEl.isPresent()) { return FixedRateStubCalculation.ofFixedRate(document.parseDecimal(rateOptEl.get())); } Optional<XmlElement> amountOptEl = baseEl.findChild("stubAmount"); if (amountOptEl.isPresent()) { return FixedRateStubCalculation.ofKnownAmount(document.parseCurrencyAmount(amountOptEl.get())); } throw new FpmlParseException("Invalid stub, fixed rate leg cannot have a floating rate stub"); }
private AdjustablePayment parsePremium(XmlElement swaptionEl, FpmlDocument document, TradeInfoBuilder tradeInfoBuilder) { XmlElement premiumEl = swaptionEl.getChild("premium"); PayReceive payReceive = document.parsePayerReceiver(premiumEl, tradeInfoBuilder); XmlElement paymentAmountEl = premiumEl.getChild("paymentAmount"); CurrencyAmount ccyAmount = document.parseCurrencyAmount(paymentAmountEl); ccyAmount = payReceive.isPay() ? ccyAmount.negated() : ccyAmount; AdjustableDate paymentDate = premiumEl.findChild("paymentDate") .map(el -> document.parseAdjustableDate(el)).get(); return AdjustablePayment.of(ccyAmount, paymentDate); }
return IborRateStubCalculation.ofKnownAmount(document.parseCurrencyAmount(amountOptEl.get()));
CurrencyAmount curr1Amount = document.parseCurrencyAmount(curr1El.getChild("paymentAmount")); CurrencyAmount curr2Amount = document.parseCurrencyAmount(curr2El.getChild("paymentAmount")); if (curr1PayReceive == PayReceive.PAY) { curr1Amount = curr1Amount.negative();
CurrencyAmount curr1Amount = document.parseCurrencyAmount(curr1El.getChild("paymentAmount")); CurrencyAmount curr2Amount = document.parseCurrencyAmount(curr2El.getChild("paymentAmount")); if (curr1PayReceive == PayReceive.PAY) { curr1Amount = curr1Amount.negative();
XmlElement initialPaymentEl = initialPaymentOptEl.get(); PayReceive payRec = document.parsePayerReceiver(initialPaymentEl, tradeInfoBuilder); CurrencyAmount amount = document.parseCurrencyAmount(initialPaymentEl.getChild("paymentAmount")); LocalDate date = initialPaymentEl.findChild("adjustablePaymentDate") .map(el -> document.parseDate(el)) CurrencyAmount notional = document.parseCurrencyAmount(protectionTermEl.getChild("calculationAmount"));
@Override public Trade parseTrade(FpmlDocument document, XmlElement tradeEl) { // supported elements: // 'payment/payerPartyReference' // 'payment/receiverPartyReference' // 'payment/paymentAmount' // 'payment/paymentDate?' // ignored elements: // 'payment/payerAccountReference?' // 'payment/receiverAccountReference?' // 'payment/paymentType?' // 'payment/settlementInformation?' // 'payment/discountFactor?' // 'payment/presentValueAmount?' TradeInfoBuilder tradeInfoBuilder = document.parseTradeInfo(tradeEl); XmlElement bulletEl = tradeEl.getChild("bulletPayment"); XmlElement paymentEl = bulletEl.getChild("payment"); BulletPayment.Builder bulletBuilder = BulletPayment.builder(); // pay/receive and counterparty bulletBuilder.payReceive(document.parsePayerReceiver(paymentEl, tradeInfoBuilder)); // payment date bulletBuilder.date(document.parseAdjustableDate(paymentEl.getChild("paymentDate"))); // amount bulletBuilder.value(document.parseCurrencyAmount(paymentEl.getChild("paymentAmount"))); return BulletPaymentTrade.builder() .info(tradeInfoBuilder.build()) .product(bulletBuilder.build()) .build(); }
CurrencyAmount notional = document.parseCurrencyAmount(fraEl.getChild("notional")); fraBuilder.currency(notional.getCurrency()); fraBuilder.notional(notional.getAmount());
CurrencyAmount principal = document.parseCurrencyAmount(termEl.getChild("principal")); termBuilder.currency(principal.getCurrency()); termBuilder.notional(principal.getAmount());