2 releases

0.1.1 Nov 18, 2020
0.1.0 Nov 18, 2020

#38 in #financial

Apache-2.0

21KB
361 lines

Financial Pallet

Overview

Equilibrium's financial pallet is an open-source substrate module that subscribes to external price feed/oracle, gathers asset prices and calculates financial metrics based on the information collected.

Documentation

For the detailed documentation please refer to rustdocs.

Installation

Make sure you have done all steps described in Installation page of the Substrate Developer Hub.

To build project run:

cargo build

Tests

To run unit tests type:

cargo test

You can see unit test report here.

In case you want run code coverage tool, please follow instructions to install tarpaulin.

To create code coverage report run:

cargo tarpaulin -v

You can see code coverage report here.

To run integration tests you need purge and run node first (see the next section for more information).

Then type:

cargo run -p integration-tests

Note that integration tests take several minutes to complete.

Running the Node

First of all please ensure that your development chain's state is empty:

cargo run --bin node-template purge-chain --dev

Now you can start the development chain:

cargo run --bin node-template --dev

Connecting Explorer

It can be very useful to connect UI to the node you just started.

To do this open https://polkadot.js.org/apps/#/explorer in your browser first.

Follow these steps to register required custom types:

  • In the main menu choose Settings tab;
  • In the Settings submenu choose Developer tab;
  • Copy content of the custom-types.json file into text box on the page;
  • Press Save button.

Development Roadmap

Milestone # Description
1 Initial implementation, subscription to oracle
2 Returns, volatilities, and correlation calculations
3 Portfolio volatility calculations, Value at Risk calculations

Future Plans

The Financial pallet will be further used in Equilibrium’s DeFi parachain for the risk and pricing models to calculate interest rate fees, assess borrower portfolio risks and overall system risks.

We have a plan of the further financial pallet evolution that will add complex and non-parametric ways of volatility, correlation and portfolio risk estimations. We will offload heavy calculations in some of these methods to designated off-chain worker.

Following additional methodologies/calculations will be introduced: EWMA, GARCH, Garman-Klass volatility estimates, as well as GARCH, CVaR, Monte-Carlo simulation, Historical simulation, and Copula methods for assessing value at risk.

License

Equilibrium Financial Pallet is Apache 2.0 licensed.


lib.rs:

Common Primitives for Financial Pallet

Overview

Use types defined in this module to integrate Financial Pallet into your Chain.

Dependencies

~6–15MB
~197K SLoC