This document details an example DAML workflow for a repo market clearing house.
In this example:
- A Repo Trading Model
- This section describes the business processes involved in trading Repurchase Agreements, 'Repos'.
- DAML Implementation
- This section describes how these business processes are modelled, and implemented in DAML.
- Automation description
- This section describes how the DAML-modeled processes can be automated
Disclaimer: This reference application is intended to demonstrate the capabilities of the DAML. You are recommended to consider other non-functional aspects, like security, resiliency, recoverability, etc prior to production use.
Prerequisites:
- You have Maven and DAML SDK installed installed and available
- Open a terminal window and change to the root directory of the repository
- Type
mvn clean package
. This creates the application DAR and JAR in thetarget
folder
Prerequisites:
- You have a Java 8 JRE installed, with java on your PATH
- You have the DAML SDK installed
- You have created the example project as detailed above
- Open a terminal window
- Change to the example folder:
cd repo-market
- Run
daml start --sandbox-option --address=localhost
- Open a new terminal window and change to the example folder
- Run the command
./scrips/start.sh
.
$ ./scripts/start.sh
This will start the system with a default trade file data/Trades12-2018-06-28.csv
. To run with another trade file add that file as an argument to the start script:
$ ./scripts/start.sh <your_trade_file>
Several example trade files are included in the data/
folder.
The script will start a Sandbox and Navigator, and run all automation processes necessary, logging progress output to the terminal.
The trades in the given trade file will load, and the system will pause, waiting for a command.
Stop the system at any time by typing the interrupt character (Cntl-C) in the terminal windows.
Prerequisites: * You have Docker and Docker-Compose installed
- Open a terminal window
- Change to the example folder:
cd repo-market
- Run the following docker-compose command:
$ docker-compose up --build
This will start all the components in docker containers and once they loaded you can access the application by browsing to http://localhost:7500/.
The example has a simple command-line interface to control the application. With this interface, you can;
- list trades available for settlement on any date
- initiate settlement for a given date
- load another set of trades from a file
To run these commands, use a new terminal window:
- Open a terminal window
- Change to the example folder:
cd repo-market
At the command promt, type ./scripts/listTrades.sh
. The response will be a list of dates and the trades available for settlement:
. code-block:: bash
$ ./scripts/listTrades.sh 2018-06-28 12 2018-11-26 120
At the command prompt, type ./scripts/doSettlement.sh <date>
, where <date>
is the settlement date. This should be of teh form YYYY-MM-DD
, as returned from the listTrades.sh
command.
The system will then proceed to settlement, and log output to the terminal. The output will appear as in the figure below.
Trade files may contain trades with different settlement dates, and the system will allow multiple settlement runs without restarting. If no trades are available for a given settlement date, a message will be printed to the terminal.
On completion, the comand will print Settled
$ ./scripts/doSettlement.sh 2018-06-28
Settled
- Log in as
CCP
- Select the
CCP Role
tab. - Select the contract
- Exercise the choice
InitiateSettlement
with the given date (2018-06-28)
At the command prompt, type ./scripts/loadTradeFile.sh <filename>
where filename
is the file. This path must be absolute, or relative to the current directory.
The command will load the file in all trading participants, which you will see reported in the terminal window where the application is running. On completion, the comand will print Injected
for each participant.
$ ./scripts/loadTradeFile.sh data/Trades120-2018-11-26.csv
Injected
Injected
Injected
Injected
To allow the workflow to be observed, trade participants delay for fixed delay before creating a RegistrationRequest
. This delay has a default value of 2 seconds, and can be set with a -d
command line option to the star script ./scripts/start.sh
. The delay is expressed in milliseconds. For example, to set the delay to half a second (500 mS), do:
$ ./scripts/start.sh -d 500
The example reads a system configuration from the file config.yaml
- you can add parties by updating this file. Make sure to define a name and new port number for the participant (see the existing file for the format). You can then create trade records for those parties in a new, or existing trade file.
Note that you will also need to add these new parties to the DA project file da.yaml
.
Next: Repo Trading Model.
CONFIDENTIAL © 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. Any unauthorized use, duplication or distribution is strictly prohibited.