AlgoTraderAlgoTrader Documentation

Chapter 18. Reconciliation

18.1. Partner Systems
18.2. Email Handling
18.3. FTP Handling

Reconciliation is the automated process for comparing the status of the system with external partner systems (e.g. executed trades, current positions, cash transactions).

Reconciliation can for example be based on files received via email or retrieved via FTP. For every partner a sub class of ReconciliationService has to be created. This class has to contain at least the method reconcile() which receives the file being processed. Depending on the file format used by the partner different mechanisms for parsing the files are available:

The actual process of receiving files via email or FTP, storing them in a directory and passing them along to the ReconcilicationServices is typically implemented through Spring Integration.

The entire process is configured inside the file applicationContext-reconciliation.xml.

The MAIL section MAIL of applicationContext-reconciliation.xml consists of the following components:

Spring Integration supports plain FTP as well as SFTP (SSH File Transfer Protocol) and FTPS (FTP over SSL). FTP Reconciliation needs to be configured on a project specific basis inside applicationContext-env.xml. A typical configuration might look like this:


<bean id="sftpSessionFactory" 
    class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">

    <property name="host" value="${sftp.host}"/>
    <property name="user" value="${sftp.user}"/>
    <property name="password" value="${sftp.password}"/>
</bean>

<int:poller 
    default="true" 
    fixed-rate="600000" 
    max-messages-per-poll="-1"/>    

<int:channel id="receiveChannel"/>

<int-sftp:inbound-channel-adapter 
    channel="receiveChannel" 
    session-factory="sftpSessionFactory"
    local-directory="file:files/sftp" 
    remote-directory="/transactions"
    />

<int:channel id="processChannel"/>

<int-file:outbound-gateway 
    request-channel="receiveChannel"
    reply-channel="processChannel"
    directory="files/reconciliation"
    mode="REPLACE" 
    delete-source-files="true"/>

<int:service-activator 
        input-channel="processChannel"      
        expression="@reconciliationService.reconcile(payload)"/>