Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,9 @@
</gitDescribe>
</configuration>
</plugin>

<!--build does not work when this plugin is enabled
and the download is blocked by the IT department-->
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
Expand All @@ -938,6 +940,7 @@
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ public enum ExceptionId {
SDC_WEB3J_SEND_ERROR,
SDC_NO_DATA_FOUND,
SDC_WRONG_INPUT,
SDC_FLOW_SCHEDULE_ERROR,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
package net.finmath.smartcontract.product.flowschedule;


import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;
import net.finmath.smartcontract.product.xml.Smartderivativecontract;

import java.util.List;


/**
* Object for structuring the flow schedule of a swap, that is the underlying of a Smart Derivative Contract, as an XML string.
* Contains information from the parent SDC and a list of {@link FlowScheduleSwapLeg},
* each representing the flow schedule of a swap leg.
*
* @author Raphael Prandtl
*/
@XmlRootElement(name = "flowScheduleSwap")
@XmlType(name = "", propOrder = {
"dltTradeId",
"dltAddress",
"uniqueTradeIdentifier",
"settlementCurrency",
"tradeType",
"parties",
"receiverPartyID",
"flowScheduleSwapLegs"
})
public class FlowScheduleSwap {
String dltTradeId;
String dltAddress;
String uniqueTradeIdentifier;
String settlementCurrency;
String tradeType;
Smartderivativecontract.Parties parties;
String receiverPartyID;
List<FlowScheduleSwapLeg> flowScheduleSwapLegs;


@XmlElement(name = "dltTradeId")
public String getDltTradeId() {
return dltTradeId;
}

public void setDltTradeId(final String dltTradeId) {
this.dltTradeId = dltTradeId;
}

@XmlElement(name = "dltAddress")
public String getDltAddress() {
return dltAddress;
}

public void setDltAddress(final String dltAddress) {
this.dltAddress = dltAddress;
}


@XmlElement(name = "uniqueTradeIdentifier")
public String getUniqueTradeIdentifier() {
return uniqueTradeIdentifier;
}

public void setUniqueTradeIdentifier(final String uniqueTradeIdentifier) {
this.uniqueTradeIdentifier = uniqueTradeIdentifier;
}

@XmlElement(name = "settlementCurrency")
public String getSettlementCurrency() {
return settlementCurrency;
}

public void setSettlementCurrency(final String settlementCurrency) {
this.settlementCurrency = settlementCurrency;
}

@XmlElement(name = "tradeType")
public String getTradeType() {
return tradeType;
}

public void setTradeType(final String tradeType) {
this.tradeType = tradeType;
}

@XmlElement(name = "parties")
public Smartderivativecontract.Parties getParties() {
return parties;
}

public void setParties(final Smartderivativecontract.Parties parties) {
this.parties = parties;
}

@XmlElement(name = "receiverPartyID")
public String getReceiverPartyID() {
return receiverPartyID;
}

public void setReceiverPartyID(final String receiverPartyID) {
this.receiverPartyID = receiverPartyID;
}

@XmlElementWrapper(name = "flowScheduleSwapLegs")
@XmlElement(name = "flowScheduleSwapLeg")
public List<FlowScheduleSwapLeg> getFlowScheduleSwapLegs() {
return flowScheduleSwapLegs;
}

public void setFlowScheduleSwapLegs(List<FlowScheduleSwapLeg> flowScheduleSwapLegs) {
this.flowScheduleSwapLegs = flowScheduleSwapLegs;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package net.finmath.smartcontract.product.flowschedule;


import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;

import java.util.List;


/**
* Object for structuring the flow schedule of a swap leg as an XML string.
* Contains the legType and a list of {@link FlowScheduleSwapLegPeriod},
* each representing the flow schedule of a single period.
*
* @author Raphael Prandtl
*/
@XmlRootElement(name = "flowScheduleSwapLeg")
@XmlType(name = "", propOrder = {
"legType",
"flowScheduleSwapLegPeriods"
})
public class FlowScheduleSwapLeg {
String legType;
List<FlowScheduleSwapLegPeriod> flowScheduleSwapLegPeriods;

@XmlElement(name = "legType")
public String getLegType() {
return legType;
}

public void setLegType(final String legType) {
this.legType = legType;
}

@XmlElementWrapper(name = "flowScheduleSwapLegPeriods")
@XmlElement(name = "flowScheduleSwapLegPeriod")
public List<FlowScheduleSwapLegPeriod> getFlowScheduleSwapLegPeriods() {
return flowScheduleSwapLegPeriods;
}

public void setFlowScheduleSwapLegPeriods(final List<FlowScheduleSwapLegPeriod> flowScheduleSwapLegPeriods) {
this.flowScheduleSwapLegPeriods = flowScheduleSwapLegPeriods;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package net.finmath.smartcontract.product.flowschedule;


import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import net.finmath.smartcontract.valuation.marketdata.data.LocalDateTimeAdapter;

import java.time.LocalDateTime;


/**
* Object for structuring the flow schedule of a swap leg period as an XML string.
* Contains the rolled-out schedule for the period and information on cash-flow.
*
* @author Raphael Prandtl
*/
@XmlRootElement(name = "flowScheduleSwapLegPeriod")
@XmlType(name = "", propOrder = {
"fixingDate",
"periodStartDate",
"periodEndDate",
"paymentDate",
"notional",
"rate",
"flowAmount"
})
public class FlowScheduleSwapLegPeriod {
LocalDateTime fixingDate;
LocalDateTime periodStartDate;
LocalDateTime periodEndDate;
LocalDateTime paymentDate;
double notional;
double rate;
double flowAmount;

@XmlElement(name = "fixingDate")
@XmlJavaTypeAdapter(LocalDateTimeAdapter.class)
public LocalDateTime getFixingDate() {
return fixingDate;
}

public void setFixingDate(final LocalDateTime fixingDate) {
this.fixingDate = fixingDate;
}

@XmlElement(name = "periodStartDate")
@XmlJavaTypeAdapter(LocalDateTimeAdapter.class)
public LocalDateTime getPeriodStartDate() {
return periodStartDate;
}

public void setPeriodStartDate(final LocalDateTime periodStartDate) {
this.periodStartDate = periodStartDate;
}

@XmlElement(name = "periodEndDate")
@XmlJavaTypeAdapter(LocalDateTimeAdapter.class)
public LocalDateTime getPeriodEndDate() {
return periodEndDate;
}

public void setPeriodEndDate(final LocalDateTime periodEndDate) {
this.periodEndDate = periodEndDate;
}

@XmlElement(name = "paymentDate")
@XmlJavaTypeAdapter(LocalDateTimeAdapter.class)
public LocalDateTime getPaymentDate() {
return paymentDate;
}

public void setPaymentDate(final LocalDateTime paymentDate) {
this.paymentDate = paymentDate;
}

@XmlElement(name = "notional")
public double getNotional() {
return notional;
}

public void setNotional(final double notional) {
this.notional = notional;
}

@XmlElement(name = "rate")
public double getRate() {
return rate;
}

public void setRate(final double rate) {
this.rate = rate;
}

@XmlElement(name = "flowAmount")
public double getFlowAmount() {
return flowAmount;
}

public void setFlowAmount(final double flowAmount) {
this.flowAmount = flowAmount;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,26 @@ public PlainSwapEditorHandler(final PlainSwapOperationRequest plainSwapOperation
fixedLeg.receiverPartyReference.href = smartDerivativeContract.underlyings.underlying.dataDocument.party.get(1);
}


floatingLeg.resetDates.fixingDates.periodMultiplier = BigInteger.valueOf(plainSwapOperationRequest.getFloatingFixingDayOffset().longValue());
if(plainSwapOperationRequest.getFloatingFixingDayOffset() != null){
logger.info("floatingFixingDayOffSet manually set to: '{}'", plainSwapOperationRequest.getFloatingFixingDayOffset());
floatingLeg.resetDates.fixingDates.periodMultiplier = BigInteger.valueOf(plainSwapOperationRequest.getFloatingFixingDayOffset().longValue());
}
logger.info("Reading back floating fixing date offset: {}", floatingLeg.resetDates.fixingDates.periodMultiplier);
floatingLeg.calculationPeriodAmount.calculation.dayCountFraction.value = plainSwapOperationRequest.getFloatingDayCountFraction();
if(plainSwapOperationRequest.getFloatingDayCountFraction() != null && !plainSwapOperationRequest.getFloatingDayCountFraction().isEmpty()) {
logger.info("floatingDayCountFraction manually set to: '{}'", plainSwapOperationRequest.getFloatingDayCountFraction());
floatingLeg.calculationPeriodAmount.calculation.dayCountFraction.value = plainSwapOperationRequest.getFloatingDayCountFraction();
}
logger.info("Reading back floating day count fraction: {}", floatingLeg.calculationPeriodAmount.calculation.dayCountFraction.value);

((FloatingRateCalculation) floatingLeg.calculationPeriodAmount.calculation.getRateCalculation().getValue()).floatingRateIndex.value = plainSwapOperationRequest.getFloatingRateIndex();
if(plainSwapOperationRequest.getFloatingRateIndex() != null && !plainSwapOperationRequest.getFloatingRateIndex().isEmpty()) {
logger.info("floatingRateIndex manually set to: '{}'", plainSwapOperationRequest.getFloatingRateIndex());
((FloatingRateCalculation) floatingLeg.calculationPeriodAmount.calculation.getRateCalculation().getValue()).floatingRateIndex.value = plainSwapOperationRequest.getFloatingRateIndex();
}
logger.info("Reading back floating rate index: {}", ((FloatingRateCalculation) floatingLeg.calculationPeriodAmount.calculation.getRateCalculation().getValue()).floatingRateIndex.value);
fixedLeg.calculationPeriodAmount.calculation.dayCountFraction.value = plainSwapOperationRequest.getFixedDayCountFraction();
if(plainSwapOperationRequest.getFixedDayCountFraction() != null && !plainSwapOperationRequest.getFixedDayCountFraction().isEmpty()) {
logger.info("fixedDayCountFraction manually set to: '{}'", plainSwapOperationRequest.getFixedDayCountFraction());
fixedLeg.calculationPeriodAmount.calculation.dayCountFraction.value = plainSwapOperationRequest.getFixedDayCountFraction();
}
logger.info("Reading back fixed day count fraction {}", fixedLeg.calculationPeriodAmount.calculation.dayCountFraction.value);
fixedLeg.calculationPeriodAmount.calculation.fixedRateSchedule.initialValue = BigDecimal.valueOf(plainSwapOperationRequest.getFixedRate()).setScale(12, RoundingMode.HALF_EVEN).divide(BigDecimal.valueOf(100L).setScale(12, RoundingMode.HALF_EVEN), RoundingMode.HALF_EVEN);
logger.info("Reading back fixed rate: {}", fixedLeg.calculationPeriodAmount.calculation.fixedRateSchedule.initialValue);
Expand Down Expand Up @@ -294,6 +305,8 @@ private static void setSdcSettlementHeaderProvidedSymbols(final PlainSwapOperati
}

private static void setSdcSettlementHeaderTemplate(final PlainSwapOperationRequest plainSwapOperationRequest, final Smartderivativecontract sdc, Smartderivativecontract templateContract) {
logger.info("setSdcSettlementHeaderTemplate with template");

Smartderivativecontract.Settlement settlementHeader = new Smartderivativecontract.Settlement();

settlementHeader.settlementTime = new Smartderivativecontract.Settlement.SettlementTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.finmath.smartcontract.model.MarketDataList;
import net.finmath.smartcontract.model.SDCException;
import net.finmath.smartcontract.product.SmartDerivativeContractDescriptor;
import net.finmath.smartcontract.product.flowschedule.FlowScheduleSwap;
import net.finmath.smartcontract.settlement.Settlement;
import net.finmath.smartcontract.valuation.marketdata.curvecalibration.CalibrationDataItem;
import org.slf4j.Logger;
Expand Down Expand Up @@ -52,10 +53,10 @@ public class SDCXMLParser {

new ConcurrentHashMap<>(
Map.of(
Smartderivativecontract.class.getCanonicalName(),
createContext(Smartderivativecontract.class),//
MarketDataList.class.getCanonicalName(), createContext(MarketDataList.class),//
Settlement.class.getCanonicalName(), createContext(Settlement.class)//
Smartderivativecontract.class.getCanonicalName(), createContext(Smartderivativecontract.class),
MarketDataList.class.getCanonicalName(), createContext(MarketDataList.class),
Settlement.class.getCanonicalName(), createContext(Settlement.class),
FlowScheduleSwap.class.getCanonicalName(), createContext(FlowScheduleSwap.class)
)
);

Expand Down
Loading
Loading