diff --git a/src/main/java/net/finmath/smartcontract/product/SmartDerivativeContractDescriptor.java b/src/main/java/net/finmath/smartcontract/product/SmartDerivativeContractDescriptor.java index 1f4e3c38..efad7c0e 100644 --- a/src/main/java/net/finmath/smartcontract/product/SmartDerivativeContractDescriptor.java +++ b/src/main/java/net/finmath/smartcontract/product/SmartDerivativeContractDescriptor.java @@ -29,6 +29,7 @@ public class SmartDerivativeContractDescriptor { private final String currency; private final String marketDataProvider; private final String tradeType; + private final String initialSettlementDate; /** * Descriptor for a smart derivative contract counterparty. Unified access to a party definition in an XML. @@ -75,7 +76,7 @@ public String toString() { } //TODO convert constructor into builder pattern or something comparable - public SmartDerivativeContractDescriptor(String dltTradeId, String dltAddress, String uniqueTradeIdentifier, LocalDateTime tradeDate, List counterparties, Map marginAccountInitialByPartyID, Map penaltyFeeInitialByPartyID, String recervicePartyID, Node underlying, List marketdataItems, String currency, String marketDataProvider, String tradeType) { + public SmartDerivativeContractDescriptor(String dltTradeId, String dltAddress, String uniqueTradeIdentifier, LocalDateTime tradeDate, List counterparties, Map marginAccountInitialByPartyID, Map penaltyFeeInitialByPartyID, String recervicePartyID, Node underlying, List marketdataItems, String currency, String marketDataProvider, String tradeType, String initialSettlementDate) { this.dltTradeId = dltTradeId; this.dltAddress = dltAddress; this.uniqueTradeIdentifier = uniqueTradeIdentifier; @@ -89,6 +90,7 @@ public SmartDerivativeContractDescriptor(String dltTradeId, String dltAddress, S this.currency = currency; this.marketDataProvider = marketDataProvider; this.tradeType = tradeType; + this.initialSettlementDate = initialSettlementDate; Validate.isTrue(counterparties.size() == 2, "Number of counterparties must be 2."); Validate.isTrue(marginAccountInitialByPartyID.size() == 2, "Number of margin accounts values must be 2."); @@ -161,4 +163,8 @@ public String getMarketDataProvider() { public String getTradeType() { return tradeType; } + + public String getInitialSettlementDate() { + return initialSettlementDate; + } } diff --git a/src/main/java/net/finmath/smartcontract/product/xml/SDCXMLParser.java b/src/main/java/net/finmath/smartcontract/product/xml/SDCXMLParser.java index 515e764b..d6baf3fd 100644 --- a/src/main/java/net/finmath/smartcontract/product/xml/SDCXMLParser.java +++ b/src/main/java/net/finmath/smartcontract/product/xml/SDCXMLParser.java @@ -98,8 +98,9 @@ public static SmartDerivativeContractDescriptor parse(String sdcxml) throws Pars String marketDataProvider = sdc.getSettlement().getMarketdata().getProvider().trim(); String tradeType = sdc.getTradeType(); + String initialSettlementDate = sdc.getSettlement().getSettlementDateInitial().trim(); - return new SmartDerivativeContractDescriptor(dltTradeId, dltAddress, uniqueTradeIdentifier, settlementDateInitial, parties, marginAccountInitialByPartyID, penaltyFeeInitialByPartyID, receiverPartyID, underlying, marketdataItems, currency, marketDataProvider, tradeType); + return new SmartDerivativeContractDescriptor(dltTradeId, dltAddress, uniqueTradeIdentifier, settlementDateInitial, parties, marginAccountInitialByPartyID, penaltyFeeInitialByPartyID, receiverPartyID, underlying, marketdataItems, currency, marketDataProvider, tradeType, initialSettlementDate); } public static T unmarshalXml(String xml, Class t) { diff --git a/src/test/java/net/finmath/smartcontract/product/xml/SDCXMLParserTest.java b/src/test/java/net/finmath/smartcontract/product/xml/SDCXMLParserTest.java index 3893fbc9..150edf48 100644 --- a/src/test/java/net/finmath/smartcontract/product/xml/SDCXMLParserTest.java +++ b/src/test/java/net/finmath/smartcontract/product/xml/SDCXMLParserTest.java @@ -46,6 +46,7 @@ void testParser() throws IOException, SAXException, ParserConfigurationException Assertions.assertEquals("0x000000001", sdc.getDltAddress()); Assertions.assertEquals("EUR", sdc.getCurrency()); Assertions.assertEquals("internal", sdc.getMarketDataProvider()); + Assertions.assertEquals("2011-12-03T10:15:30", sdc.getInitialSettlementDate()); // Get parties List parties = sdc.getCounterparties(); @@ -154,6 +155,7 @@ void marshalSDCToXMLString() throws IOException, ParserConfigurationException, S Assertions.assertEquals("0x000000001", sdcDescriptor.getDltAddress()); Assertions.assertEquals("EUR", sdcDescriptor.getCurrency()); Assertions.assertEquals("internal", sdcDescriptor.getMarketDataProvider()); + Assertions.assertEquals("2011-12-03T10:15:30", sdcDescriptor.getInitialSettlementDate()); } } \ No newline at end of file