Project Zero DeFi Simulator
Project description
WARNING: original source file is docs/getting_started.rst
Getting Started
ProjectZero 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, ZeroAlpha makes it easy to experiment, iterate, and bring DeFi protocols and strategies from concept to execution.
This repository is the public endpoint for the zeroalpha 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/projectzero-io/zeroalpha-extension/.
Prerequisites
Before installing the ZeroAlpha, ensure you have:
- Python 3.12 or 3.13
- pip package manager
Installation
Install the ZeroAlpha using pip:
pip install zeroalpha
Note: This installation will also include several other packages provided by ProjectZero.
Environment Configuration
Get your API key from
https://register.projectzero.io
The following command creates a projectzero-quantlib.toml file with the required proxy configuration for accessing ProjectZero gRPC API.
Make sure to replace YOUR_API_KEY.
(
echo '[grpc]'
echo 'url = "https://ns31798707.ip-198-244-253.eu:50051"'
echo 'api-key = "<YOUR_API_KEY>"'
echo '[eth-rpc]'
echo 'url = "https://ns31798707.ip-198-244-253.eu/reth"' # <- or your own JSON RPC access to an Ethereum archive node
echo 'api-key = "<YOUR_API_KEY>"'
) > projectzero-quantlib.toml
Then, export it as an environment variable:
export QUANTLIB_CONFIG=/path/to/projectzero-quantlib.toml
Verify Installation
First, verify that the installation was successful:
import zeroalpha
print(f"ZeroAlpha version: {zeroalpha.__version__}")
Quick Start
Basic Use Case
Here’s a simple example to get you started with the ZeroAlpha:
from zeroalpha import Simulation
from zeroalpha.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
- Documentation: https://projectzero-io.github.io/zeroalpha/
- Explore Core Concepts - Learn about the fundamental architecture and components
- Study How to Build - Dive deeper into configuration and practical examples
- Check the API Reference - Detailed documentation of all classes and methods
- GitHub Issues: https://github.com/projectzero-io/zeroalpha/issues
- Contact: Contact us to sdk@projectzero.io for joining us on private Telegram channel
- Examples: Explore practical implementations in the examples directory. JSON schemas are provided to ensure proper format and validation.
Now that you have the ZeroAlpha installed and understand the basics, you might want to:
Known issues and roadmap
Coming soon:
- API stabilisation
- API examples with arbitrageur or other multi-actor 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 ZeroAlpha uses quantlib and ProjectZero gRPC server 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 |
projectzero-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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zeroalpha-0.7.2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: zeroalpha-0.7.2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 12.3 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2277bf2aa0b3152f285baee0820e728c65a74e6c758ff996f2fdaf72b7756a90
|
|
| MD5 |
a163d23567bf515537bcb9b74dd42d28
|
|
| BLAKE2b-256 |
9f71ea4c1cf37a2a03731c4864497a6c29e415fadf02bad7261664fe32ba50c3
|
File details
Details for the file zeroalpha-0.7.2-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: zeroalpha-0.7.2-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 14.5 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f72c1b7949fd7e7d67c3e41fab736afa3b177f68b30ef06085eb42b5e8d58983
|
|
| MD5 |
3c67f48d93ecbfe8c83f74f9b05923a3
|
|
| BLAKE2b-256 |
2dd5d1e3a7d3aa6dc15f4c07d5b4f9e1be835f040a91c94f1d6a248eec41b419
|
File details
Details for the file zeroalpha-0.7.2-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: zeroalpha-0.7.2-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 23.2 MB
- Tags: CPython 3.13, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
394d0aefd4207b5258c17b76afa579d9150c4cb730abff584fb64cbe84426678
|
|
| MD5 |
50aa530537f7094f4c2bd2762c945e08
|
|
| BLAKE2b-256 |
3bd18008e9bedb1d1be26dfd74634adaf738cf01b0b0401128dc146ce60827a1
|
File details
Details for the file zeroalpha-0.7.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: zeroalpha-0.7.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 12.3 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
374873b655704d8fc5f3a198da7ab8b3c0e3030c5705445c8d4b3d3552e8b69a
|
|
| MD5 |
823ff490d19f972c83c979820561ec65
|
|
| BLAKE2b-256 |
0ae0790af7341dc0b348c067585ca15c51b0f5bf588ecc64af81e7c13c474ddd
|
File details
Details for the file zeroalpha-0.7.2-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: zeroalpha-0.7.2-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 14.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ba08c73219f88546e13eb1ab3a31e3bbe14033928a45b54225013f64f34300a
|
|
| MD5 |
5bd480cca7f2b3014096911d652d4294
|
|
| BLAKE2b-256 |
3ffe7362419365f56f247a8349951ceb2eb4c6b4527c1e8a398041903951f7fc
|
File details
Details for the file zeroalpha-0.7.2-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: zeroalpha-0.7.2-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 23.2 MB
- Tags: CPython 3.12, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d5f7cc1fb9015e6f113703b58cb5d776d4e6b61198b6eb1e7fcfaafd3d1d58d
|
|
| MD5 |
71108f3a35399c9ed0a938cb01083961
|
|
| BLAKE2b-256 |
b88fd3068b4d3f2faa118211fae94b27914e5b0898fcaf3a00f619b057e8fe3e
|