WARNING: original source file is docs/getting_started.rst

Getting Started

Nuant Quantitative System SDK is a purpose-built SDK for decentralized finance. It enables a unified lifecycle that supports research, protocol-level simulation, backtesting, optimization, and live monitoring. Designed to empower quants, researchers, and developers, NQS makes it easy to experiment, iterate, and bring DeFi protocols and strategies from concept to execution.

This repository is the public endpoint for the nqs-sdk package, available on PyPI, providing all the tools needed to build, test, and run strategies within a single, integrated environment.

For additional examples and tests, please visit the companion repository at https://github.com/Nuant/nqs-sdk-extension/.

Prerequisites

Before installing the NQS SDK, ensure you have:

  • Python 3.12 or 3.13

  • pip package manager

Installation

Install the NQS SDK using pip:

pip install nqs-sdk

Note: This installation will also include several other packages provided by Nuant.

Environment Configuration

Get your API key from

https://agents.nuant.ai/subscribe

The following command creates a nuant-quantlib.toml file with the required proxy configuration for accessing Nuant’s GraphQL API. Make sure to replace YOUR_API_KEY.

(
echo "[proxy]"
echo 'url = "https://data.app.nuant.com/graphql"'
echo 'api-key = "YOUR_API_KEY" # <- the one, you got previously'
) > nuant-quantlib.toml

Then, export it as an environment variable:

export QUANTLIB_CONFIG=/path/to/nuant-quantlib.toml

Verify Installation

First, verify that the installation was successful:

import nqs_sdk
print(f"NQS SDK version: {nqs_sdk.__version__}")

Quick Start

Basic Use Case

Here’s a simple example to get you started with the NQS SDK:

from nqs_sdk import Simulation
from nqs_sdk.protocols import UniswapV3Factory
import json

# Initialize simulation with protocols and configuration
uniswap_v3 = UniswapV3Factory() # factory for all UniswapV3 instances
sim = Simulation([uniswap_v3], "./examples/configs/basic_config.yml")

# Run the simulation
all_observables = sim.run()

# Access results
print(f"Simulation completed with {len(all_observables)} observables")

Tips:

  • By default, the execution is quiet, and you can make it verbose to watch the execution flow.

  • Data queries to feed the simulation can be expensive; consider setting the quantlib cache to make it faster.

for both, see Useful environment variables section below.

Getting Involved

Now that you have the NQS SDK installed and understand the basics, you might want to:

Known issues and roadmap

Coming soon:

  • API stabilisation

  • API examples with arbitrageur or other multi-agent scenarios

And later:

  • Compound V2 support, more protocols will follow

  • Open Rust API to extend core interfaces directly in Rust

  • API for external data provider

    (Currently, the NQS SDK uses quantlib and data.app.nuant.com for data handling.)

  • EVM based any protocol executions

Known issues:

  • Support of Python 3.11

  • Support of Linux arm64

Useful environment variables

Variable name

Example

Description

QUANTLIB_CONFIG

nuant-quantlib.toml

Path to a config file in TOML format

QUANTLIB_CACHE

./your_dir/.cache

Cache directory to optimize quantlib calls
(be sure to create the directory)

RUST_LOG

debug

Configure the log level of core engine

For more environment variables, see Environment variables