# Implementing Post-trade Allocation

This page describes how to implement FX Sales' Post-trade Allocation feature in your trading adapter.

## Requirements

You require:

* **Front end:** FX Sales 2.33 or greater, configured to use the [User Config](../fx-integration-api/fxapi-user-config.md) to supply user entitlements instead of permissioning.
* **Back end:** an integration adapter built against the FX Integration API 3.69 or later, with a registered implementation of the [`AllocateTradeListener`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/trading/allocate/AllocateTradeListener.html) interface.

## Overview

Perform each of the steps below:

1. [Implement the AllocateTradeListener interface](#implement-the-allocatetradelistener-interface)
2. [Register your implementation of AllocateTradeListener](#register-your-implementation-of-allocatetradelistener)
3. [Add PTA fields to trade confirmation messages](#add-pta-fields-to-trade-confirmation-messages)
4. [Configure user entitlements](#configure-user-entitlements)
5. [Configure Post-trade Allocation in FX Sales](#configure-post-trade-allocation-in-fx-sales)

## Implement the AllocateTradeListener interface

In this section you will implement the [`AllocateTradeListener`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/trading/allocate/AllocateTradeListener.html) interface.

`AllocateTradeListener` handles client-sent events in the [Allocate](../fx-integration-api/fxapi-trade-model-allocate.md) trade model, the state diagram for which is reproduced below:

```plantuml
@startuml

[*] --> Initial<<Terminator>>
Initial -[#ECAF28]-> DetailsRequested : [[/developer/fx-integration-api/fxapi-trade-model-allocate#detailsrequest DetailsRequest]]
DetailsRequested --> DetailsProvided : [[/developer/fx-integration-api/fxapi-trade-model-allocate#allocationspotdetailsupdate DetailsUpdate]]
DetailsRequested -[#ECAF28]-> ClientCloseSent : [[/developer/fx-integration-api/fxapi-trade-model-allocate#clientclose ClientClose]]
DetailsProvided -[#ECAF28]-> Submitted : [[/developer/fx-integration-api/fxapi-trade-model-allocate#submit Submit]]
DetailsProvided -[#ECAF28]-> ClientCloseSent : [[/developer/fx-integration-api/fxapi-trade-model-allocate#clientclose ClientClose]]
Submitted --> Allocated : [[/developer/fx-integration-api/fxapi-trade-model-allocate#allocateack AllocateAck]]
Submitted --> Queued : [[/developer/fx-integration-api/fxapi-trade-model-allocate#submitack SubmitAck]]
Allocated<<Terminator>> --> [*]
Queued --> Expired : [[/developer/fx-integration-api/fxapi-trade-model-allocate#expire Expire]]
Queued -[#ECAF28]-> ClientCloseSent : [[/developer/fx-integration-api/fxapi-trade-model-allocate#clientclose ClientClose]]
Queued --> PickedUp : [[/developer/fx-integration-api/fxapi-trade-model-allocate#pickup PickUp]]
Expired<<Terminator>> --> [*]
ClientCloseSent --> ClientClosed : [[/developer/fx-integration-api/fxapi-trade-model-allocate#clientcloseack ClientCloseAck]]
ClientClosed<<Terminator>> --> [*]
PickedUp --> Queued : [[/developer/fx-integration-api/fxapi-trade-model-allocate#hold Hold]]
PickedUp --> Executable : [[/developer/fx-integration-api/fxapi-trade-model-allocate#spotquote PriceUpdate]]
PickedUp -[#ECAF28]-> ClientCloseSent : [[/developer/fx-integration-api/fxapi-trade-model-allocate#clientclose ClientClose]]
Executable --> Expired : [[/developer/fx-integration-api/fxapi-trade-model-allocate#expire Expire]]
Executable -[#ECAF28]-> ExecuteSent : [[/developer/fx-integration-api/fxapi-trade-model-allocate#execute Execute]]
Executable --> Executable : [[/developer/fx-integration-api/fxapi-trade-model-allocate#spotquote PriceUpdate]]
Executable -[#ECAF28]-> Submitted : [[/developer/fx-integration-api/fxapi-trade-model-allocate#resubmit Resubmit]]
Executable -[#ECAF28]-> ClientCloseSent : [[/developer/fx-integration-api/fxapi-trade-model-allocate#clientclose ClientClose]]
Executable --> PickedUp : [[/developer/fx-integration-api/fxapi-trade-model-allocate#withdraw Withdraw]]
ExecuteSent --> Executed : [[/developer/fx-integration-api/fxapi-trade-model-allocate#executeack ExecuteAck]]
ExecuteSent --> ExecuteSent : [[/developer/fx-integration-api/fxapi-trade-model-allocate#spotquote PriceUpdate]]
ExecuteSent --> WarningSent : Warning
Executed --> Expired : [[/developer/fx-integration-api/fxapi-trade-model-allocate#expire Expire]]
Executed --> TradeConfirmed : [[/developer/fx-integration-api/fxapi-trade-model-allocate#allocationconfirmation TradeConfirmation]]
TradeConfirmed<<Terminator>> --> [*]
WarningSent -[#ECAF28]-> AcceptWarningSent : [[/developer/fx-integration-api/fxapi-trade-model-allocate#acceptwarning AcceptWarning]]
WarningSent -[#ECAF28]-> Executable : [[/developer/fx-integration-api/fxapi-trade-model-allocate#rejectwarning RejectWarning]]
WarningSent -[#ECAF28]-> ClientCloseSent : [[/developer/fx-integration-api/fxapi-trade-model-allocate#clientclose ClientClose]]
AcceptWarningSent --> Executed : [[/developer/fx-integration-api/fxapi-trade-model-allocate#acceptwarningack AcceptWarningAck]]



legend left
**__Legend__**
Transitions initiated by the client are in <color:#ECAF28><b>yellow</b></color>.
Transitions initiated by the server are in <color:#003E67><b>blue</b></color>.
end legend
@enduml
```

<dl><dt><strong>📌 NOTE</strong></dt><dd>

Once an [Allocate](../fx-integration-api/fxapi-trade-model-allocate.md) trade enters the Queued state, the trade model is identical to the RFS trade model. If your system already supports the [RFS trade model](../fx-integration-api/fxapi-trade-model-rfs.md) and implements the [`RFSTradeListener`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/trading/rfs/RFSTradeListener.html) interface, it is likely you can reuse that class for generating price updates and trade confirmation messages with some small modifications to support the Allocation trading type.
</dd></dl>

Follow the steps below:

1. Create an implementation of the [`AllocateTradeListener`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/trading/allocate/AllocateTradeListener.html) interface:

   ```plantuml
   @startuml
   package com.caplin.generated.motif.fx.trading.allocate {
     interface AllocateTradeListener {
       {abstract} +onDetailsRequest(AllocateTradeEvent)
       {abstract} +onClientClose(ClientCloseTradeEvent)
       {abstract} +onSubmit(SubmitTradeEvent)
       {abstract} +onExecute(SubmitTradeEvent)
       {abstract} +onTradeClosed()
     }
   }
   class MyAllocateTradeListener {
     - AllocateTrade allocateTrade
     --
     +MyAllocateTradeListener(AllocateTrade)
     ..
     +onDetailsRequest(DetailsRequestTradeEvent)
     +onClientClose(ClientCloseTradeEvent)
     +onSubmit(SubmitTradeEvent)
     +onExecute(ExecuteTradeEvent)
     +onTradeClosed()
   }
   AllocateTradeListener <|-- MyAllocateTradeListener
   @enduml
   ```
2. In the constructor for your implementation, store a reference to the [`AllocateTrade`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/trading/allocate/AllocateTrade.html) constructor parameter:

   ```java
   public class MyAllocateTradeListener implements AllocateTradeListener
   {
     private AllocateTrade allocateTrade = null;

     public MyAllocateTradeListener(AllocateTrade allocateTrade)
     {
       this.allocateTrade = allocateTrade;
     }

     ...
   }
   ```
3. Implement the following `AllocateTradeListener` methods:
   * [`onDetailsRequest`](#implement-ondetailsrequest)
   * [`onClientClose`](#implement-onclientclose)
   * [`onSubmit`](#implement-onsubmit)
   * [`onExecute`](#implement-onexecute)
   * [`onTradeClosed`](#implement-ontradeclosed)

### Implement onDetailsRequest

When the user launches an allocation, a DetailsRequest message is received from the client and the `onDetailsRequest(DetailsRequestTradeEvent)` listener is triggered.

In the `onDetailsRequest(DetailsRequestTradeEvent)` method of your implementation, handle the client’s request for trade details:

1. Using the `TradeID` field of the `DetailsRequestTradeEvent` as a reference, request the trade’s details from your trading system.
2. Check the trade is identified by the trading system as allocatable, and perform any further validation required by your implementation. If the trade is invalid, then send a Reject message to the client:

   ```java
   this.allocateTrade.sendRejectTradeEvent();
   ```
3. If the trade is valid, then create and send a DetailsUpdate message to the client:
   1. Create an instance of [AllocationSpotSalesDetailsUpdate](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/tradeconfirmation/TradeConfTypesDef.AllocationSpotSalesDetailsUpdate.html) or [AllocationForwardSalesDetailsUpdate](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/tradeconfirmation/TradeConfTypesDef.AllocationForwardSalesDetailsUpdate.html) using the class’s associated builder, accessed via the `newBuilder()` method.
   For documentation on the builders, see [AllocationSpotSalesDetailsUpdate.Builder](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/tradeconfirmation/TradeConfTypesDef.AllocationSpotSalesDetailsUpdate.Builder.html) and [AllocationForwardSalesDetailsUpdate.Builder](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/tradeconfirmation/TradeConfTypesDef.AllocationForwardSalesDetailsUpdate.Builder.html).

      ```java
      // Build the DetailsUpdate message
      Message tradeDetails = AllocationSpotSalesDetailsUpdate.newBuilder()
                                        .setSpotSalesTradeConfirmation( ... )
                                        .setDisplayFields( ... )
                                        // ... example truncated
      ```

      The DisplayFields value on the DetailsUpdate message determines which fields are displayed under the Original Deal Details heading. You may use the utility method [`addDefaultSalesAllocationDetailsUpdateFields`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/motif/fx/config/DefaultDisplayFields.html#addDefaultSalesAllocationDetailsUpdateFields-com.caplin.motif.fx.config.DisplayFields-java.lang.String-java.lang.String-int-java.lang.String-java.lang.String-int-java.lang.String-java.lang.String-java.lang.String-java.lang.String-java.lang.String-int-int-int-boolean-java.lang.String-java.lang.String-java.lang.String-), which adds the Caplin-default display fields to a [`DisplayFields`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/motif/config/definitions/common/DisplayFields.html) instance. Using this method, you may add custom fields before or after the default fields. Alternatively, you can compose your display fields configuration field by field, combining your custom fields with Caplin-default fields, for which [`DefaultDisplayFields`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/motif/fx/config/DefaultDisplayFields.html) provides static builders methods.

      **📌 NOTE**\
      The Caplin-default display fields for the Sales Allocate DetailsUpdate message are: Amount, Contra Amount, Currency Pair, Settlement Currency (if non-deliverable), Settlement, Fixing Date (if non-deliverable), Fixing Source (if non-deliverable), Account and Rate.
   2. Send the `AllocationSpotSalesDetailsUpdate` or `AllocationForwardSalesDetailsUpdate` message to the client:

      ```java
      // Send the DetailsUpdate message to the client
      this.allocateTrade.sendDetailsUpdateEvent(tradeDetails);
      ```

### Implement onClientClose

In the `onClientClose(ClientCloseEvent)` method of your implementation, handle the client’s closure of the allocation:

1. Perform any clean up and logging required by your implementation
2. Send a ClientCloseAck message to the client:

   ```java
   this.allocateTrade.sendClientCloseAckTradeEvent();
   ```

### Implement onSubmit

When a user submits the allocation they want to perform, a Submit message is sent to your adapter and the `onSubmit(SubmitTradeEvent)` listener method is called.

In the `onSubmit(SubmitTradeEvent)` method of your implementation, handle the submitted allocation:

1. Retrieve the legs from the `SubmitTradeEvent` instance and validate them. If any of the allocation legs are invalid, then send a Reject message to the client:

   ```java
   this.allocateTrade.sendRejectTradeEvent();
   ```
2. If the settlement date of each leg is identical to the settlement date of the original trade, then follow the steps below:
   1. Send an AllocateAck message to the client, which transitions the trade from the ***Submitted*** state to the ***Allocated*** state:

      ```java
      this.allocateTrade.sendAllocateAckTradeEvent();
      ```
   2. Re-allocate the trade using your trading system’s API.
   3. Update [blotter records](../fx-integration-api/fxapi-blotter-records.md) for the original trade:

      | Field | Value |
      | --- | --- |
      | Status | Allocated |
      | CanAllocate | false |
      | CanRoll | false |
      | IsAllocated | true |
3. If the settlement date of any leg is different to the settlement date of the original trade, then follow the steps below.
   1. Send a SubmitAck message to the client, which transitions the trade from the **Submitted** state to the **Queued** state:

      ```java
      this.allocateTrade.sendSubmitAckTradeEvent();
      ```
   2. Currently, manual pricing via dealer intervention is not supported for allocations. Do not send the allocation to the active deals blotter. Instead, immediately send a PickUp message to the client, which transitions the trade from the **Queued** state to the **PickedUp** state:

      ```java
      this.allocateTrade.sendPickUpTradeEvent();
      ```
   3. Send the first of a series of PriceUpdate messages, which transitions the trade from the **PickedUp** state to the **Executable** state:

      ```java
      // Build the PriceUpdate message
      PriceUpdateTradeEvent priceUpdate = AllocationQuote.newBuilder()
                                        .setCommonTradeDetailsFields( ... )
                                        // ... example truncated

      this.allocateTrade.sendPriceUpdateEvent(priceUpdate);
      ```

### Implement onExecute

When the user attempts to finalise a reprice allocation, an Execute message is received from the client and the `onExecute(ExecuteTradeEvent)` listener method will be triggered.

In the `onExecute(ExecuteTradeEvent)` method of your implementation, perform the following steps:

1. Send an ExecuteAck message to the client, which transitions the trade from the **Executable** state to the **ExecuteSent** state:

   ```java
   this.allocateTrade.sendExecuteAckTradeEvent();
   ```
2. Validate the ExecuteTradeEvent legs. If the leg data is invalid, then send a Reject message to the client:

   ```java
   this.allocateTrade.sendRejectTradeEvent();
   ```
3. If the leg date is valid, perform the following steps:
   1. Re-allocate the trade using your trading system’s API.

      <dl><dt><strong>📌 NOTE</strong></dt><dd>

      New trades created from repriced legs should use the rate and margin details of the [Allocate](../fx-integration-api/fxapi-trade-model-allocate.md) trade, however legs that were not repriced should still use the details of the original trade.
      </dd></dl>
   2. Send a TradeConfirmation message to the client:

      ```java
      // Build the TradeConfirmed message
      AllocationSalesConfirmation msg = AllocationSalesConfirmation.newBuilder()
                                                          .setCommonFields( ... )
                                                          .setDisplayfields( ... )
                                                          // ... example truncated

      this.allocateTrade.sendTradeConfirmationEvent(msg);
      ```

      The DisplayFields value on the DetailsUpdate message drives which fields are displayed above the trade confirmation table. You may utilise the utility method [`addDefaultSalesAllocationConfirmationFields`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/motif/fx/config/DefaultDisplayFields.html#addDefaultSalesAllocationConfirmationFields-com.caplin.motif.fx.config.DisplayFields-java.lang.String-java.lang.String-java.lang.String-java.lang.String-java.lang.String-java.lang.String-java.lang.String-java.lang.String-int-int-int-int-java.lang.String-java.lang.String-int-boolean-java.lang.String-java.lang.String-), which adds the Caplin-default display fields to a [`DisplayFields`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/motif/config/definitions/common/DisplayFields.html) instance. Using this method, you may add custom fields before or after the default fields. Alternatively, you can compose your display fields configuration field by field, combining your custom fields with Caplin-default fields, for which [`DefaultDisplayFields`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/motif/fx/config/DefaultDisplayFields.html) provides static builders methods.

      **📌 NOTE**\
      The Caplin-default display fields for the Sales Allocate TradeConfirmation message are: Client, Currency Pair, Settlement Currency (if non-deliverable), Fixing Source (if non-deliverable), Date, Time, Trader Spot Rate, Spot Margin, Client Spot Rate, Total Deals, Estimated Profit.
   3. Update [blotter records](../fx-integration-api/fxapi-blotter-records.md) for the original trade:

      | Field | Value |
      | --- | --- |
      | Status | Allocated |
      | CanAllocate | false |
      | CanRoll | false |
      | IsAllocated | true |

### Implement onTradeClosed

In the `onTradeClosed` method in your implementation, handle any clean up and logging required when the trade channel is closed.

## Register your implementation of AllocateTradeListener

Implement and register an instance of [`AllocateTradeListenerFactory`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/trading/allocate/AllocateTradeListenerFactory.html) with the [FXTradeAdapter](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/motif/fx/trading/FXTradeAdapter.html) instance in your adapter.

The code example below creates and registers an anonymous implementation of the [`AllocateTradeListenerFactory`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/trading/allocate/AllocateTradeListenerFactory.html) interface:

```java
fxTradeAdapter.registerAllocateTradeListenerFactory(
  new AllocateTradeListenerFactory() {
    @Override
    public AllocateTradeListener createTradeListener(AllocateTrade trade)
        throws TradeException {
      return new MyAllocateTradeListener(trade);
    }
  }
)
```

The code above can also be expressed using a [Java method reference](https://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html) to the `MyAllocateTradeListener` constructor, which shares the same method signature as the method `createTradeListener` in [`AllocateTradeListenerFactory`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/trading/allocate/AllocateTradeListenerFactory.html):

```java
fxTradeAdapter.registerAllocateTradeListenerFactory(MyAllocateTradeListener::new);
```

## Add PTA fields to trade confirmation messages

Wherever your back end code creates a trade confirmation message, set values for the `CanAllocate`, `CanRoll` and `IsAllocated` fields in the [`CommonTradeConfirmationFields`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/tradeconfirmation/TradeConfPartsDef.CommonTradeConfirmationFields.html) field set.

The [`CommonTradeConfirmationFields`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/tradeconfirmation/TradeConfPartsDef.CommonTradeConfirmationFields.html) field set is used in TradeConfirmation messages in the following trade models:

* [ESP](../fx-integration-api/fxapi-trade-model-esp.md) trade model
* [RFS](../fx-integration-api/fxapi-trade-model-rfs.md) trade model
* [Amend](../fx-integration-api/fxapi-trade-model-amend.md) trade model
* [SalesIntervention](../fx-integration-api/fxapi-trade-model-salesintervention.md) trade model

The [`CommonTradeConfirmationFields`](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/tradeconfirmation/TradeConfPartsDef.CommonTradeConfirmationFields.html) field set is used in the following blotter records:

* [SpotBlotterRecord](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/blotter/BlotterTypesDef.SpotBlotterRecord.html) and [SpotSalesBlotterRecord](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/blotter/BlotterTypesDef.SpotSalesBlotterRecord.html)
* [ForwardBlotterRecord](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/blotter/BlotterTypesDef.ForwardBlotterRecord.html) and [ForwardSalesBlotterRecord](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/blotter/BlotterTypesDef.ForwardSalesBlotterRecord.html)
* [SwapTradeBlotterRecord](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/blotter/BlotterTypesDef.SwapTradeBlotterRecord.html) and [SwapSalesTradeBlotterRecord](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/blotter/BlotterTypesDef.SwapSalesBlotterRecord.html)
* [InterventionSpotBlotterRecord](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/blotter/BlotterTypesDef.InterventionSpotBlotterRecord.html), [InterventionForwardBlotterRecord](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/blotter/BlotterTypesDef.InterventionForwardBlotterRecord.html), and [InterventionSwapBlotterRecord](https://docs.caplin.com/developer/api/fxintegration/latest/com/caplin/generated/motif/fx/blotter/BlotterTypesDef.InterventionSwapBlotterRecord.html)

**Field definitions**

* **CanAllocate**\
When you set this field to `true`, it indicates to front-end applications that the back-end trading system supports allocation of this trade.
* **CanRoll**\
When you set this field to `true`, it indicates to front-end applications that the back-end trading systems supports the rolling of settlement dates during allocations of this trade.
* **IsAllocated**\
When you set this field to `true`, it indicates to front-end applications that the trade has been allocated _and_ can no longer be allocated or rolled (regardless of the value of `CanAllocate`).

Front-end applications should refer to the values of both `CanAllocate` and `IsAllocated` to determine if a trade is allocatable.

**Determining if a trade is allocatable or rollable**

| CanAllocate | CanRoll | IsAllocated | Trade is allocatable? | Trade is rollable? |
| :-: | :-: | :-: | :-: | :-: |
| true | true | true | #icon:close[]# | #icon:close[]# |
| true | true | false | icon:check[] | icon:check[] |
| true | false | true | #icon:close[]# | #icon:close[]# |
| true | false | false | icon:check[] | #icon:close[]# |
| false | true | true | #icon:close[]# | #icon:close[]# |
| false | true | false | #icon:close[]# | icon:check[] |
| false | false | true | #icon:close[]# | #icon:close[]# |
| false | false | false | #icon:close[]# | #icon:close[]# |

## Configure user entitlements

Post-trade Allocation is enabled via the Configuration Service.

Add the following feature to the feature configuration in your client configuration:

```java
new FXFeatures().postAllocation(new FXFeaturesPostAllocation().enabled(true));
```

If `CAPLIN.PTA.ENTITY_SEARCH.ENABLED` is enabled, i.e. if the Client or Entity column is shown on your frontend, add the following feature to the feature configuration in your user configuration:

```java
new FXFeatures().postAllocation(new FXFeaturesPostAllocation().toboSelection(USER_CONFIG));
```

For `toboSelection`, choose either `USER_CONFIG` to provide clients via user config, or `CLIENT_SEARCH` to provide clients via the client search API.

For more information on the configuration service see, see [User Config](../fx-integration-api/fxapi-user-config.md).

## Configure Post-trade Allocation in FX Sales

The following FX Sales configuration items apply to Post-trade Allocation:

* **CAPLIN.PTA.ENTITY_SEARCH.ENABLED**\
Set to `true` to display the client column in the allocation table on Post-trade Allocation tickets.
The client column allows the trader to allocate to a different client than that of the original trade.
For more information, see [CAPLIN.PTA.ENTITY_SEARCH.ENABLED](st-fx-sales-configuration.md#caplin-pta-entity-search-enabled).
* **CAPLIN.MOTF.TICKET.ACCOUNT.ALLOW_NULL_SELECTION**\
Set to `true` to allow traders to allocate to null trading accounts.
Also allows traders to trade against null trading accounts in MOTF tickets.
For more information, see [CAPLIN.MOTF.TICKET.ACCOUNT.ALLOW_NULL_SELECTION](st-fx-sales-configuration.md#caplin-motf-ticket-account-allow-null-selection)
* **CAPLIN.MOTF.TICKET.ACCOUNT.AUTO_SELECT_FIRST**\
Set to `true` to automatically select the first valid trading account after changing the value in a Client cell in the allocation table on Post-trade Allocation tickets (see [CAPLIN.PTA.ENTITY_SEARCH.ENABLED](st-fx-sales-configuration.md#caplin-pta-entity-search-enabled)).
Also automatically selects the first valid trading account in MOTF tickets.
For more information, see
[CAPLIN.MOTF.TICKET.ACCOUNT.AUTO_SELECT_FIRST](st-fx-sales-configuration.md#caplin-motf-ticket-account-auto-select-first)

---

**See also:**

* [CAPLIN.PTA.ENTITY_SEARCH.ENABLED](st-fx-sales-configuration.md#caplin-pta-entity-search-enabled)
* [CAPLIN.MOTF.TICKET.ACCOUNT.ALLOW_NULL_SELECTION](st-fx-sales-configuration.md#caplin-motf-ticket-account-allow-null-selection)
* [CAPLIN.MOTF.TICKET.ACCOUNT.AUTO_SELECT_FIRST](st-fx-sales-configuration.md#caplin-motf-ticket-account-auto-select-first)
* [Post-trade Allocation feature overview](st-post-trade-allocation.md)
