• Insight
  • Monday 13th November 2023

Hello, CDM! Three Easy Steps to Implement the Common Domain Model in Java

Over the past decade, building a more efficient and robust post-trade processing framework has become a key priority for financial institutions. The Common Domain Model (CDM) is one of the most promising technologies to emerge from this transition.

The CDM is an open-source, human-readable and machine-executable data model for trade products and processes. It creates a digital representation of contracts and events across the lifecycle of financial transactions while supporting the conversion to and from existing messaging standards. This allows market participants to achieve consistency in the interpretation and implementation of post-trade requirements.

The number of applications using the CDM has firmly reached two-digit territory, and following ISDA’s launch of Digital Regulatory Reporting (DRR) 1.0 – built on the CDM, we can expect uptake and the number of use-cases to increase further.

Most developers will usually take the same course of action when using a new piece of tech or software: google it to see how it works. What typically appears is an article that goes something like; ‘Hey - here’s how you get started on X new library / technology’. We have all come across those easy-to-follow ‘Hello, world!’ pages where you can run a pilot in the most basic way possible to give your new piece of tech a first run-through.

With its rising adoption, at REGnosys we often came across users and clients who wanted a step-by-step guide on how to implement the CDM. While the ‘REGnosys’s’ of the world have been heavily involved in the development of the CDM’s infrastructure and are familiar with how it works, there is a whole segment of financial market participants who are likely to want to use the CDM, but may not know how to easily implement it.

The purpose of this guide is to fill this void. Here is our step-by-step manual that developers can use to implement the CDM.

Step 1 - Get the CDM

Choose a version

There are two versions of the CDM that users may be interested in; the production version and the development version. 

The production version offers a stable, well-supported production environment for consumers of the model. Unless under exceptional circumstances, no new disruptive feature shall be introduced, mostly bug fixes only. Any change shall adhere to a strict governance process as it must be backward-compatible.

In contrast, the development version fosters continued, rapid change development and involves model contributions made by the industry community. Changes that break backward compatibility are allowed.

Developers will need to choose which version they want to implement.

Read the docs

Once you’ve chosen which version of the CDM you wish to use, make sure to read the latest updates on it. In addition to release notes which accompany new updates, there is reasonably good documentation on what the CDM is and how it is structured which can help you get started. 

A lot of this can be found on the CDM’s docs website on GitHub, which you can find here

Install via Maven Central

You can add the below dependency to your maven pom file to install the CDM:

See Maven Central for more details, including snippets for other build systems such as Gradle, ivy, sbt and more. 

Remember, everything is open source!

The code for the CDM is available on the FINOS GitHub. This means that if you are a developer and want to use the code, you can look at it yourself to make sure the code is of high-quality and meets the right standards.

Step 2 - Set up the code

This step is more hands-on and includes some more general rules of thumb for setting up any new piece of software.

Java 8 or later

Java 8 is now a fairly old version of Java, but the CDM is functional with Java 8 or any later version. In short, you can’t use the CDM with any version of Java before Java 8.

Set up your IDE

Check out the FINOS CDM from GitHub, create a project using your preferred IDE and install using Maven to download any dependencies. After that, you’ll be able to compile and start coding.

Step 3 - Start coding

Load or create CDM data

The CDM is primarily a data model. Rather than a solution to a specific problem, it’s better to think of the CDM as a ‘library’ (in programming speak) distributed in multiple languages and directly usable in different solution implementations, meaning it offers a number of ‘tools’.

One of these tools is ‘serialisation’ and ‘deserialisation’ to JSON. This is the process of converting the state of an object (a trade, for example), that is, the values of its properties, into a JavaScript Object Notation (JSON) which can be stored or transmitted, and then converting it back into an object. 

The CDM contains nearly 500 JSON examples showing trades from many asset classes including Interest Rates, Equity, Commodity, FX, Credit, Repo and more, in addition to examples of post-trade business events such as terminations and novations. Furthermore the equivalent FpML representation (in XML) is also provided for comparison. You can take a look in the FINOS GitHub resources folder to find an example, then download and deserialise.

You can also build your own CDM data using Java - see worked examples of how to do this (and many other useful things) in FINOS GitHub examples.

Execute functionality

The CDM not only provides a standardised product and event data model but also executable functions that standardise post-trade processes such as terminations and novations.

Using Google Guice dependency injection, you can inject and execute any CDM functions.  Take a look at the FINOS GitHub examples, and review classes such as CreateNovationEventTest and CreatePartialTerminationEventTest which demonstrate how to inject CDM functions and execute using data loaded from JSON.

This example in CreatePartialTerminationEventTest is illustrated in the diagram below through the case of partial termination.

Get involved...

The CDM was built upon the premise of open industry collaboration and has an established active community to inform its development. Developers can join a range of working groups to raise issues, give advice and offer tips on how to best drive the evolution of the CDM moving forwards. All changes are open, and anyone can comment on change requests. 

The CDM has gone from strength to strength over the past year. In September 2022, FINOS was selected by ISDA, ICMA and ISLA as the open source repository for the CDM and earlier this year, it released version 4.0. The new version features a range of technological advancements, including contribution of the Repo model, a new Python distribution, enhancements to the product qualifications, an eligible collateral specification model and a cash collateral interest model. 

REGnosys has been pleased to work with our clients over the last year on these changes, and is looking forward to another exciting year ahead.

Get in touch here if you’d like to speak with one of our experts about implementing the CDM.

Hugo Hills

Hugo Hills

VP of Engineering at REGnosys

Read more