Skip to content

Commit

Permalink
Merge pull request #104 from Julius278/feature/660
Browse files Browse the repository at this point in the history
SDC-660, added initialSettlementDate to SDC Descriptor
  • Loading branch information
Julius278 authored Nov 18, 2024
2 parents 6531078 + 28cd297 commit 8603b00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<Party> counterparties, Map<String, Double> marginAccountInitialByPartyID, Map<String, Double> penaltyFeeInitialByPartyID, String recervicePartyID, Node underlying, List<CalibrationDataItem.Spec> marketdataItems, String currency, String marketDataProvider, String tradeType) {
public SmartDerivativeContractDescriptor(String dltTradeId, String dltAddress, String uniqueTradeIdentifier, LocalDateTime tradeDate, List<Party> counterparties, Map<String, Double> marginAccountInitialByPartyID, Map<String, Double> penaltyFeeInitialByPartyID, String recervicePartyID, Node underlying, List<CalibrationDataItem.Spec> marketdataItems, String currency, String marketDataProvider, String tradeType, String initialSettlementDate) {
this.dltTradeId = dltTradeId;
this.dltAddress = dltAddress;
this.uniqueTradeIdentifier = uniqueTradeIdentifier;
Expand All @@ -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.");
Expand Down Expand Up @@ -161,4 +163,8 @@ public String getMarketDataProvider() {
public String getTradeType() {
return tradeType;
}

public String getInitialSettlementDate() {
return initialSettlementDate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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> T unmarshalXml(String xml, Class<T> t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SmartDerivativeContractDescriptor.Party> parties = sdc.getCounterparties();
Expand Down Expand Up @@ -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());
}

}

0 comments on commit 8603b00

Please sign in to comment.