Caplin FXIntegrationAPI Documentation - Version 8.4.0

Message Builder Example - AllocationConfirmation

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 AllocationConfirmationExample {
    public static void main(String[] args) {
                    		
		TradeConfTypesDef.AllocationConfirmation allocationConfirmation =
		TradeConfTypesDef.AllocationConfirmation
			.newBuilder()
			.addAllocationNettedLegTradeConfirmationFields(
			TradeConfTypesDef.AllocationNettedLegTradeConfirmationFields
				.newBuilder()
				.addAllocationInputLegTradeConfirmationFields(
				TradeConfPartsDef.AllocationLegTradeConfirmationFields
					.newBuilder()
					.setDisplayFields(addDefaultSalesAllocationDetailsUpdateFields(/* See DefaultDisplayFields javadoc for parameters and available builder methods. */))
					.setMarkToMarket(BigDecimal.valueOf(12.45))
					.build())
				.setAllocationNettedLegTradeConfirmation(
				TradeConfPartsDef.AllocationLegTradeConfirmationFields
					.newBuilder()
					.build())
				.build())
			.addNettedLegTradeConfirmationFields(
			TradeConfTypesDef.NettedLegTradeConfirmationFields
				.newBuilder()
				.addInputLegSwapPartnerTradeConfirmation(
				TradeConfPartsDef.SwapPartnerLegTradeConfirmationFields
					.newBuilder()
					.setSwapPartnerInputLegID("")
					.setSwapPartnerNettedLegID(0)
					.build())
				.addInputLegTradeConfirmation(
				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())
				.addInputNDFLegTradeConfirmation(
				TradeConfPartsDef.NDFLegTradeConfirmationFields
					.newBuilder()
					.setFixingAmount(BigDecimal.valueOf(0.0))
					.setFixingCode("[CCY]1/1600/GBLO")
					.setFixingCurrency("USD")
					.setFixingDate("20150620")
					.setFixingDescription("WMR [CCY] 4pm London")
					.setReferenceAmount("")
					.setReferenceCurrency(BigDecimal.valueOf(0.0))
					.setSettlementAmount("")
					.build())
				.setIsReprice("")
				.setNdfNettedLegTradeConfirmation(
				TradeConfPartsDef.NDFLegTradeConfirmationFields
					.newBuilder()
					.build())
				.setNettedLegTradeConfirmation(
				TradeConfPartsDef.LegTradeConfirmationFields
					.newBuilder()
					.build())
				.build())
			.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")
				.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())
			.setDisplayFields(addDefaultSalesAllocationDetailsUpdateFields(/* See DefaultDisplayFields javadoc for parameters and available builder methods. */))
			.setNdfFields(
			TradeConfPartsDef.NDFTradeConfirmationFields
				.newBuilder()
				.setFixingSource("WMR 8am London Time")
				.setSettlementCurrency("GBP")
				.build())
			.setNetFields(
			TradeConfPartsDef.NetConfirmationFields
				.newBuilder()
				.setNetBuySell("")
				.setNetContraAmount("1123400")
				.setNetDealtAmount(BigDecimal.valueOf(1000000))
				.build())
			.setNettedAmount(BigDecimal.valueOf(0.0))
			.build();
            
    }
}