private AdjustableDate parseExpiryDate(XmlElement europeanExerciseEl, FpmlDocument document) { XmlElement expirationDate = europeanExerciseEl.getChild("expirationDate"); return expirationDate.findChild("adjustableDate") .map(el -> document.parseAdjustableDate(el)).get(); }
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); }
.map(el -> document.parseAdjustableDate(el)) .orElseGet(() -> document.parseAdjustedRelativeDateOffset(calcPeriodDatesEl.getChild("relativeEffectiveDate"))); accrualScheduleBuilder.startDate(startDate.getUnadjusted()); .map(el -> document.parseAdjustableDate(el)) .orElseGet(() -> document.parseAdjustedRelativeDateOffset(calcPeriodDatesEl.getChild("relativeTerminationDate"))); accrualScheduleBuilder.endDate(endDate.getUnadjusted()); accrualScheduleBuilder.overrideStartDate(document.parseAdjustableDate(el)); });
AdjustableDate effectiveDate = document.parseAdjustableDate(generalTermsEl.getChild("effectiveDate")); AdjustableDate terminationDate = document.parseAdjustableDate(generalTermsEl.getChild("scheduledTerminationDate")); BusinessDayAdjustment bda = generalTermsEl.findChild("dateAdjustments") .map(el -> document.parseBusinessDayAdjustments(el))
fraBuilder.paymentDate(document.parseAdjustableDate(fraEl.getChild("paymentDate")));
@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(); }