digital-asset / contingent-claims

Apache License 2.0
5 stars 0 forks source link

License CircleCI

Copyright © 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

:mega: Deprecation notice :mega:

The Contingent Claims library is now part of Daml Finance and development is continuing on the Daml Finance repository.

Contingent Claims

This is a library for modeling contingent claims, i.e. derivatives, written in the smart contract language Daml. Briefly, a derivative is represented by a tree of Claims, which describe future cashflows between two parties as well as the conditions under which these cashflows occur.

The library offers life-cycling capabilities, as well as a valuation semantics that maps a claim to a mathematical expression that can be used for no-arbitrage pricing.

The implementation closely follows the model outlined in the papers [1], [2].

To get started, we recommend reading through the quickstart document.

Examples of how to create and lifecycle contracts can be found in the test directory.

How to use this library

To use the library in your Daml project, it is sufficient to download the latest *.dar file from the releases page and add it as a dependency to your project.

Releases

Releases adhere to the 'semantic versioning' specification. Breaking changes across major versions are documented in Upgrading.md. The steps required to release this library are documented in RELEASE.MD.

Building the code

In order to build the code from source, follow these instructions.

  1. Clone the repository

  2. Make sure the Daml SDK is installed on your machine

  3. Fetch the *.dar file for the latest version of the daml-ctl library and copy it to the lib/ folder in the repository's root

  4. You can then build a release version (no tests in the *.dar) by running daml build in the root directory, or a dev version that includes tests from the test directory.

We also provide an unsupported Makefile with targets for said tasks.

Running the tests

Navigate to the test directory and run daml test.

API documentation

API documentation for the latest release is available online here.

You can also build this locally using the SDK command daml damlc docs from the root directory. There is also an unsupported make doc target.

Contribution Policy

If you wish to contribute to this project, please contact us first via Github. In future, we do plan to accept external contributions, contingent on the Digital Asset CLA.

References

[1] Jones, S. Peyton, Jean-Marc Eber, and Julian Seward. "Composing contracts: an adventure in financial engineering." ACM SIG-PLAN Notices 35.9 (2000): 280-292.

[2] Jones, SL Peyton, and J. M. Eber. "How to write a financial contract", volume "Fun Of Programming" of "Cornerstones of Computing." (2005).

The papers can be downloaded from Microsoft Research.