Skip to main content
Version: 2.0.1

Class Implementations

Each of the classes that you can provide as inputs for the simulator have to implement an Interface. The main goal of this is to force a standardized class that the simulator can easily parse and use to run simulations.

  • Agent AgentInterface
  • Environment EnvironmentInterface
  • Strategy StrategyInterface
  • Protocols
    • Dex DexInterface
    • Lending LendingInterface
    • Custom CustomProtocolInterface
  • Metrics
    • Agent AgentMetricInterface
    • Environment EnvironmentMetricInterface
    • Simulator GlobalMetricInterface

To start coding these classes you can start by looking at the example configuration which is provided through simcli generate. This can be a good starting point to modify the files and build your own configurations.

File names

File naming is very specific to what you're building. Here is an overview of which files you need to have available:

Agent, Environment, Strategy, Metrics

  • main.py required (the main file from which the class is imported)
  • almanak-library.yaml required (an additional file that has be included for each class which provides the simulator with metadata and is required for using the library system)

Protocols

  • almanak-library.yaml required (an additional file that has be included for each class which provides the simulator with metadata and is required for using the library system)
  • At least one of:
    • dex.py optional (class that implements the DexInterface)
    • lending.py optional (class that implements the LendingInterface)
    • custom.py optional (class that implements the CustomProtocolInterface)

Almanak Library file

The almanak-library.yaml is a required file for every class item, regardless if the item is actually uploaded to the library or just used directly in the simulator.

The library system allows you to publish classes so others (or just you) can easily re-use it. Think of it as the NPM or PyPi for the Almanak Simulator.

To clarify; you don't need to use the library system. Its completely optional, you can just code your classes locally and use file:// as the prefix to the path of the directory in which the required files have been built (as long as the directory is available in the same or child folders of the configuration.yaml).

It only makes sense to use the library system when you want to share your classes with others (either publicly or privately). If you don't plan on doing this, its recommended to just keep your files locally.

The almanak-library.yaml file has a few standard parameters that are always required. On top of that, there are class specific configurations. The following items are always required:

name: "Super amazing environment"
version: "1.0.0"
type: "environment" # agent, strategy, protocol, metric
author: "Almanak Blockchain Labs"
description: ""
license: "MIT"

The specifics for each of the classes and how to add them to your configuration file correctly can be found in their respective documentation: