BancorML is a library that builds, optimizes, and evaluates machine learning pipelines in the context of a multi-agent system


Install
pip install bancorml==0.2.38

Documentation

bciAVM

PyPI bancorml-0.1.0-py3-none-any.whl package in bancorml@Release feed in Azure Artifacts

BancorML is a DeFi multi-agent-reinforcement-learning (MARL) simulation library that builds, optimizes, and evaluates machine learning pipelines using domain-specific objective functions.

Combined with Gym, BancorML can be used to create end-to-end MARL solutions.

The library demonstrates the following features:

Key Functionality

  • Gym Environments - Gym Environment API based trading simulator with continuous observation space and discrete action space.

    • Obsevation Space - Observation at a time step is the relative

    • Action Space - Action space is discrete with distinct possible actions

  • MARL Solvers - High-level multi-agent reinforcement learning components, written in pytorch.

  • Component Graphs - A component graph is comprised of nodes representing components, and edges between pairs of nodes representing where the inputs and outputs of each component should go.

  • TrainableAgent - Agent object inheritance

First time using Azure Artifacts with pip on this machine?

Get the tools

The easiest way to use Python packages from the command line is with pip (19.2+) and the Azure Artifacts keyring.

Step 1

Download Python

Step 2

Update pip

```console
$ python -m pip install --upgrade pip
```

Step 3

Install the keyring

```console
$ pip install keyring artifacts-keyring
```

Step 4

If you're using Linux, ensure you've installed the prerequisites, which are required for artifacts-keyring.

Project setup

Ensure you have installed the latest version of the Azure Artifacts keyring from the "Get the tools" section above. If you don't already have one, create a virtualenv using these instructions from the official Python documentation. Per the instructions, "it is always recommended to use a virtualenv while developing Python applications."

Add a pip.ini (Windows) or pip.conf (Mac/Linux) file to your virtualenv

```console
[global]
index-url=https://pkgs.dev.azure.com/gcode-ai/BancorML/_packaging/bancorml/pypi/simple/
```

Install

bancorml is available for Python 3.7, 3.8, and 3.9. It can be installed from pypi, conda-forge, or from Azure Artifacts.

To install bancorml with all dependencies using Azure Artifacts, Run this command in your project directory:

```console
$ pip install
```

TODO: Setup private conda

```console
$ conda install -c conda-forge bancorml
```

TODO: Setup private pypi

```console
$ pip install bancorml
```

Windows Additional Requirements & Troubleshooting

If you are using pip to install bancorml on Windows, it is recommended you first install the following packages using conda:

  • numba (needed for shap and prediction explanations). Install with conda install -c conda-forge numba
  • graphviz if you're using bancorml's plotting utilities. Install with conda install -c conda-forge python-graphviz

The XGBoost library may not be pip-installable in some Windows environments. If you are encountering installation issues, please try installing XGBoost from Github before installing bancorml or install bancorml with conda.

Mac Additional Requirements & Troubleshooting

In order to run on Mac, LightGBM requires the OpenMP library to be installed, which can be done with HomeBrew by running:

brew install libomp

Additionally, graphviz can be installed by running:

brew install graphviz

Start

import bancorml
from bancorml.utils import converters, parse_json_tests, load_test_data
from bancorml.environments import Bancor3

X, indx = load_test_data().sample(1), 0

a, b, c, e, n, x, w, m, _p, _q, _r, _s, _t, _u = bancorml.utils.parse_json_tests(X, indx)
t_is_surplus = True if X['is_tkn_surplus'].values[0]=='True' else False

protocol = Bancor3(is_solidity=False)
is_surplus, is_deficit = protocol.check_surplus(b, c, e, n)
assert is_surplus == t_is_surplus, f"is_surplus={is_surplus} != t_is_surplus={t_is_surplus} on index={indx}"

Next Steps

Read more about bancorml on our documentation page:

Roadmap Algorithm Support

Single-agent algorithms

Q-learning DQN Actor-Critic DDPG TD3

Multi-agent algorithms

minimaxQ PHC JAL MAAC MADDPG

Support

Project support can be found in four places depending on the type of question:

  1. For bugs, issues, or feature requests start a Github issue.
  2. For everything else, the core developers can be reached by email at mike@bancor.network

Built by Bancor Research Team

bancorml is a project built by bancor.network.

bancorml