Prototype risk modeling simulation for Portfolio using Arbiter.

Overview

proto-sim

Prototype simulation using Arbiter as the simulation & agent engine.

Build & Run

build.sh

cargo run

Arbiter config

The arbiter.toml config defines the initial parameterization of the underlying price process and pool parameters.

Project Structure

  • analysis - Contains analysis scripts for the simulation results.
    • trading_function - Contains scripts for analyzing the trading function.
  • bisection - Implements the bisection algorithm in rust.
  • calls - Agent wrapper abstraction for gracefully handling EVM transactions and calls.
  • cli - Handles the cli parser and matching commands.
  • common - Static variables used across the sim as default values.
  • config - Loads the arbiter.toml config into a deserialized struct type.
  • log - Fetches EVM state and loads it into a DataFrame type that can be written to a csv.
  • main - Main entry point for the cli.
  • math - Implements the Portfolio Strategy math in rust.
  • plots - Implements utility functions for plotting simulation csv or other data.
  • raw_data - Handles the storage of the raw EVM state that is processed by log.
  • setup - Handles the simulation environment setup, including contract and agents deployment.
  • sim - Implements the simulation loop and agent interaction.
  • spreadsheetorizer - Converts the DataFrame raw data type to a csv which can be written to a file.
  • step - Handles a "simulation step" in the simulation loop in sim.rs.
  • task - Handles a specific agent task in the simulation loop in sim.rs.

Basic Sim Example

use arbiter::prelude::*;
use bindings::weth;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Simulation manager is the controller of the arbiter simulation environment.
    let mut manager = SimulationManager::new();

    // Get a deployer account from the manager.
    let admin = manager.agents.get("admin").unwrap();

    // Deploy a contract to the EVM.
    let contract = SimulationContract::new(weth::WETH_ABI.clone(), weth::WETH_BYTECODE.clone());
    let (weth, tx_deploy) = admin.deploy(weth, vec![])?;

    // Add it to the manager's deployed contracts list.
    manager.deployed_contracts.insert("weth".to_string(), weth);

    // Execute EVM transactions, log the data, and repeat.
    admin.call(weth, "deposit", vec![1000]).await?;
}
You might also like...
Hiisi is a proof of concept libSQL written in Rust following TigerBeetle-style with deterministic simulation testing.
Hiisi is a proof of concept libSQL written in Rust following TigerBeetle-style with deterministic simulation testing.

Hiisi Proof of concept libSQL server written in Rust with deterministic simulation testing. Why Hiisi? SQLite is a versatile database, but serverless

Safe, fast, small crypto using Rust

THE SOFTWARE IS PROVIDED "AS IS" AND BRIAN SMITH AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES

X25519 elliptic curve Diffie-Hellman key exchange in pure-Rust, using curve25519-dalek.
X25519 elliptic curve Diffie-Hellman key exchange in pure-Rust, using curve25519-dalek.

x25519-dalek A pure-Rust implementation of x25519 elliptic curve Diffie-Hellman key exchange, with curve operations provided by curve25519-dalek. This

Exploration of using Storage instead of Allocator to parameterize collections in Rust

storage-poc aims at exploring the usage of custom Storages, rather than custom Allocators. Goals This is a Proof-of-Concept aiming at: Demonstrating t

A CLI Twitter client using kuon
A CLI Twitter client using kuon

petit A TUI Twitter client using kuon Install Use cargo $ cargo install petit How to use # Login for twitter $ petit login # Tweet $ petit tweet "Thi

Fast Hilbert space-filling curve transformation using a LUT
Fast Hilbert space-filling curve transformation using a LUT

Fast Hilbert Fast Hilbert 2D curve computation using an efficient Lookup Table (LUT). Convert from discrete 2D space to 1D hilbert space and reverse V

QuickDash A modern alternative to QuickSFV using Rust.
QuickDash A modern alternative to QuickSFV using Rust.

QuickDash A modern alternative to QuickSFV using Rust. It's supports BLAKE3 and BLAKE2 hashes, CRC32, MD5, SHA1, SHA2, SHA3, xxHash The docs for user

shavee is a Program to automatically decrypt and mount ZFS datasets using Yubikey HMAC as 2FA or any USB drive with support for PAM to auto mount home directories.

shavee is a simple program to decrypt and mount encrypted ZFS user home directories at login using Yubikey HMAC or a Simple USB drive as 2FA written in rust.

Decrypt your LUKS partition using a FIDO2 compatible authenticator

fido2luks This will allow you to unlock your LUKS encrypted disk with an FIDO2 compatible key. Note: This has only been tested under Fedora 31, Ubuntu

Minimal template for simulating contracts with arbiter.

arbiter-template Minimal template for simulating contracts with arbiter. Usage Clone this repository git clone https://github.com/primitivefinance/arb

Primitive 28 Aug 15, 2023
Automatically assess and score software repositories for supply chain risk.

Hipcheck Hipcheck scores risks for software projects; yours and your dependencies. It analyzes repositories to assess risks, review development practi

The MITRE Corporation 6 Jan 26, 2023
A prototype project integrating jni rust into Kotlin and using protobuf to make them work together

KotlinRustProto a prototype project integrating jni rust into Kotlin and using protobuf to make them work together How to start add a RPC call in Droi

woo 11 Sep 5, 2022
Prototype: ORAM and related for Intel SGX enclaves

mc-oblivious Traits and implementations for Oblivious RAM inside of Intel SGX enclaves. The scope of this repository is: Traits for fast constant-time

MobileCoin 37 Nov 23, 2022
A prototype implementation of the Host Identity Protocol v2 for bare-metal systems, written in pure-rust.

Host Identity Protocol for bare-metal systems, using Rust I've been evaluating TLS replacements in constrained environments for a while now. Embedded

null 31 Dec 12, 2022
A fast tool to scan prototype pollution vulnerability written in Rust. 🦀

ppfuzz Prototype Pollution Fuzzer A fast tool to scan prototype pollution vulnerability written in Rust. ?? Installation Binary Source Dependencies Us

Dwi Siswanto 410 Dec 27, 2022
Implementation of Sunny's Mesh Security talk (Hackathon / Prototype status)

mesh-security (Hackathon / Prototype status) An implementation of Sunny's Mesh Security talk from Cosmoverse 2022. This should run on any CosmWasm ena

CosmWasm 83 Apr 17, 2023
NIP-41 "HD" Key Invalidation Prototype

NIP-41 "HD" Key Invalidation Prototype NIP-41 is a proposal for a scheme whereby a Nostr identity key can be invalidated to a new one safely. nostr-pr

optout 3 Apr 19, 2023
AMCOS - A high-peformance parallel monte-carlo simulation for estimating the fair value of options in finance

antoons-monte-carlo-options-sim A high-peformance parallel monte-carlo simulation for estimating the fair value of options in finance. Written in Rust

null 4 Jun 18, 2022
✨ rudimentary simulation of the three-body problem

✨ three_body a very rudimentary simulation of the three-body problem. i was curious how far we could get with just euler's method and a small time ste

carl 151 May 12, 2024