Caplin FXIntegrationAPI Documentation - Version 8.4.0

Message Builder Example - TicketSpotSalesTradeConfirmation

package com.caplin.examples.fxapi.generated.motif.fx.tradeconfirmation.TradeConfTypesDef; 

import java.math.BigInteger;
import static com.caplin.motif.fx.config.DefaultDisplayFields.addDefaultSalesAllocationDetailsUpdateFields;
import static com.caplin.motif.fx.config.definitions.common.Tag;

import com.caplin.generated.motif.fx.settlementinstructions.SettlementInstructionsPartsDef;
import com.caplin.generated.motif.fx.tradeconfirmation.TradeConfPartsDef;
import com.caplin.generated.motif.fx.tradeconfirmation.TradeConfTypesDef;

public class TicketSpotSalesTradeConfirmationExample {
    public static void main(String[] args) {
                    		
		TradeConfTypesDef.TicketSpotSalesTradeConfirmation ticketSpotSalesTradeConfirmation =
		TradeConfTypesDef.TicketSpotSalesTradeConfirmation
			.newBuilder()
			.setCommonSpotSalesTradeConfirmation(
			TradeConfTypesDef.CommonSpotSalesTradeConfirmation
				.newBuilder()
				.setCommonSpotTradeConfirmation(
				TradeConfTypesDef.CommonSpotTradeConfirmation
					.newBuilder()
					.setCommonFields(
					TradeConfPartsDef.CommonTradeConfirmationFields
						.newBuilder()
						.setAccount("Garfields|GARF")
						.setAccountEditable()
						.setAllocationSettlementDateOptions("ORIGINAL,EARLIER,LATER")
						.setAmountDPS("2")
						.setAssetType("")
						.setBackOfficeID("")
						.setCanAllocate("")
						.setCanDrawdown(true)
						.setClient("")
						.setClientAgreementDateTime("")
						.setClientAgreementDateTimeEditable()
						.setContraAmountDPS(2)
						.setContraCostAmount("")
						.setContraCostCurrency("GBP")
						.setContraCostCurrencyDPS("2")
						.setContraCostPercentage(BigDecimal.valueOf(13.56))
						.setCostAmount(BigDecimal.valueOf(12412891.31))
						.setCostCurrency("GBP")
						.setCostCurrencyDPS(2)
						.setCostPercentage("13.56")
						.setCurrencyPair("")
						.setDealtCurrency("GBP")
						.setDealtCurrencyEditable()
						.setDealtCurrencyRisk()
						.setDeliverableType("")
						.setDigitsBeforePips("2")
						.setEntityDescription("Customer 1")
						.setEntityId("CUSTONE")
						.setExecutionDateTime("20160322123621")
						.setFullName("")
						.setIsAllocated("")
						.setIsAmendable(true)
						.setIsCancellable(true)
						.setIsReversible("")
						.setNumberOfPips("2")
						.setOrderID("")
						.setOriginalTradeID("")
						.setPostTradeType("")
						.setPriceSource("st1@caplin.com")
						.setPurpose("Commercial")
						.setRemarks("")
						.setServiceContraCostCurrencyDPS("2")
						.setServiceCostCurrencyDPS(2)
						.setSpotMidRate(BigDecimal.valueOf(1.08345))
						.setSpotRate("1.08341")
						.setSpotRateDPS("5")
						.setTOBOUser("", true, true)
						.setTOBOUserEditable()
						.setTOBOUserRisk()
						.setTags(Arrays.asList(/* ... */))
						.setTradeDate("20160314")
						.setTradeID("00001561")
						.setTraderUsername("sales_trader@novobank.co.za")
						.setTradingType("")
						.setUTI("")
						.setVenue("FX Sales")
						.setWarningCode("001")
						.setWarningMessage("You do not have sufficient credit for EUR")
						.build())
					.setLegTradeConfirmation(
					TradeConfPartsDef.LegTradeConfirmationFields
						.newBuilder()
						.addRemarks(
						TradeConfPartsDef.RemarksEntry
							.newBuilder()
							.setRemarkDateTime(Instant.now())
							.setRemarkOriginStatus("")
							.setRemarkSource("")
							.setRemarkTargetStatus("")
							.build())
						.setAccount("Garfields|GARF")
						.setAdjustedSwapPoints(BigDecimal.valueOf(0.0))
						.setAllInMidRate(BigDecimal.valueOf(1.091790))
						.setAllInRate("1.091790")
						.setAllInRateDPS("5")
						.setAllocatableAmount(BigDecimal.valueOf(500))
						.setAllocatableContraAmount(BigDecimal.valueOf(500))
						.setAmount(BigDecimal.valueOf(0.0), true, true)
						.setAmountEditable()
						.setAmountRisk()
						.setBuySell("")
						.setContraAmount("500")
						.setContraCostAmount("")
						.setContraCostCurrency("GBP")
						.setContraCostPercentage("13.56")
						.setCostAmount(BigDecimal.valueOf(12412891.31))
						.setCostCurrency("GBP")
						.setCostPercentage("13.56")
						.setEntityDescription("Customer 1")
						.setEntityId("CUSTONE")
						.setFilledAmount("0")
						.setForwardPointsDecimalOffset(0)
						.setFullName("")
						.setFwdMidPoints(BigDecimal.valueOf(0.005390))
						.setFwdPips("11.98")
						.setFwdPoints("0.001198")
						.setIsTimeOption("true")
						.setNostroAccountFields(
						SettlementInstructionsPartsDef.NostroAccount
							.newBuilder()
							.setNostroAccount("AE770090004000824676500")
							.setNostroBIC("ARABAEADABC")
							.setNostroName("GBP Nostro Account.")
							.build())
						.setOriginalRate("")
						.setProfit(BigDecimal.valueOf(1000))
						.setRemainingAmount(BigDecimal.valueOf(500))
						.setRemarks(
						TradeConfPartsDef.RemarksEntry
							.newBuilder()
							.build(), 0)
						.setRiskDate("20160314")
						.setRiskTenor("1W")
						.setServiceContraCostAmount("")
						.setServiceContraCostCurrency("GBP")
						.setServiceCostAmount(BigDecimal.valueOf(0.0))
						.setServiceCostCurrency("GBP")
						.setSettlementDate("")
						.setSettlementDateEditable()
						.setSettlementDateRisk()
						.setSettlementTradeFields(
						SettlementInstructionsPartsDef.SettlementTradeFields
							.newBuilder()
							.addPay(
							SettlementInstructionsPartsDef.SettlementFields
								.newBuilder()
								.setBankAccount("12345678")
								.setBankAddress1("12 Capitol")
								.setBankAddress2("The City")
								.setBankAddress3("London")
								.setBankName("Bank Of Caplin")
								.setBankSwift("CAP123")
								.setIndividualAccount("87654321")
								.setIndividualAddress1("98 Lane")
								.setIndividualAddress2("Manchester")
								.setIndividualName("Susan Sellers")
								.setIndividualSwift("SOLD987")
								.setIsDefaultSettlementInstruction(true)
								.setNettingStatus("NETTED")
								.setSettlementAmount("")
								.setSettlementCurrency("GBP")
								.setSettlementDetailsLine1("")
								.setSettlementDetailsLine2("")
								.setSettlementDetailsLine3("")
								.setSettlementDetailsLine4("")
								.setSettlementDetailsLine5("")
								.setSettlementDetailsLine6("")
								.setSettlementDirection("")
								.setSettlementDisplayName("[CCY] Account 1")
								.setSettlementId("")
								.setSettlementInstructionType("EXISTING")
								.setSettlementStatus("")
								.setSplitComponentId("")
								.build())
							.addPayNettingComponents(
							SettlementInstructionsPartsDef.NettingComponents
								.newBuilder()
								.setAmount("0")
								.setBuySell("")
								.setTradeID("00001561")
								.build())
							.addReceive(
							SettlementInstructionsPartsDef.SettlementFields
								.newBuilder()
								.build())
							.addReceiveNettingComponents(
							SettlementInstructionsPartsDef.NettingComponents
								.newBuilder()
								.build())
							.setAffirmedBy("")
							.setAffirmedDateTime(Instant.now())
							.setCanAdHoc("")
							.setCanAffirm(true)
							.setCanApproveInstructions("")
							.setCanAutoConfirm(true)
							.setCanCancel(true)
							.setCanConfirm(true)
							.setCanDispute(true)
							.setCanRejectInstructions(true)
							.setCanRelease(true)
							.setCanReplace("")
							.setCanUnconfirm("")
							.setConfirmedBy("")
							.setConfirmedDateTime(Instant.now())
							.setIsPayNetted("")
							.setIsPayNettingRequired("")
							.setIsPaySplit("")
							.setIsReceiveNetted(true)
							.setIsReceiveNettingRequired(true)
							.setIsReceiveSplit("")
							.setNextActionDeadline("2018-03-16T07:25:16+00:00")
							.setNextActionDeadlineDisplayTimezone("America/New_York")
							.setSettlementStatus("")
							.build())
						.setStartDate("20150620")
						.setStartDateRisk()
						.setStartTenor("1W")
						.setStartTenorRisk()
						.setTOBOUser("client@customer.co.za")
						.setTOBOUserEditable()
						.setTOBOUserRisk()
						.setTenor("", true, true)
						.setTenorEditable()
						.setTenorRisk()
						.setTradeID("00001561")
						.build())
					.build())
				.setNearSalesLegTradeConfirmation(
				TradeConfPartsDef.SalesLegTradeConfirmationFields
					.newBuilder()
					.addTraderRemarks(
					TradeConfPartsDef.RemarksEntry
						.newBuilder()
						.build())
					.setAdjustedSwapMargin("")
					.setAdjustedTraderSwapPoints("")
					.setAllInMargin("0.00054")
					.setAllInMarginEditable()
					.setFwdMargin(BigDecimal.valueOf(0.000019))
					.setFwdMarginEditable()
					.setOriginalMargin("")
					.setTOBOUser("client@customer.co.za")
					.setTOBOUserEditable()
					.setTOBOUserRisk()
					.setTraderAllInRate("1.005390")
					.setTraderFwdPoints("0.005390")
					.setTraderOriginalRate(BigDecimal.valueOf(0.0))
					.setTraderRemarks(
					TradeConfPartsDef.RemarksEntry
						.newBuilder()
						.build(), 0)
					.build())
				.setSalesCommonFields(
				TradeConfPartsDef.SalesCommonTradeConfirmationFields
					.newBuilder()
					.setCompetition(true)
					.setIsAdvised("")
					.setProfit(BigDecimal.valueOf(1000))
					.setProfitCurrency("USD")
					.setProfitCurrencyDPS("5")
					.setProfitIsHouse(true)
					.setProfitRate(BigDecimal.valueOf(1.091790))
					.setReasons("")
					.setSource("WMR 8am London Time")
					.setSpotMargin(BigDecimal.valueOf(0.0), true)
					.setSpotMarginEditable()
					.setStreamingMode("MANUAL, STREAMING")
					.setTraderSpotAskRate("1.08575")
					.setTraderSpotBidRate(BigDecimal.valueOf(1.08575))
					.setTraderSpotRate("1.09174")
					.build())
				.build())
			.setDisplayFields(addDefaultSalesAllocationDetailsUpdateFields(/* See DefaultDisplayFields javadoc for parameters and available builder methods. */))
			.setSettlementTradeFields(
			SettlementInstructionsPartsDef.SettlementSummaryTradeFields
				.newBuilder()
				.build())
			.build();
            
    }
}