Skip to main content

Overview

NanoARB uses a trait-based strategy system that separates trading logic from execution infrastructure. All strategies implement the Strategy trait, enabling hot-swapping, backtesting, and consistent interfaces across different trading approaches.

Strategy Trait

Defined in nano-core/src/traits.rs:48:

Strategy Lifecycle

Implemented in nano-strategy/src/base.rs:8:

Base Strategy

All strategies should build on BaseStrategy which handles common functionality:

Position Tracking

From nano-strategy/src/base.rs:80:

Market Making Strategy

Provides liquidity by quoting both sides of the market. Implemented in nano-strategy/src/market_maker.rs:167:

Inventory Skewing

From nano-strategy/src/market_maker.rs:197:

Quote Management

Tracks active orders on both sides:

Signal-Based Strategy

Trades based on ML model predictions or technical signals. Implemented in nano-strategy/src/signals.rs:114:

Processing Signals

From nano-strategy/src/signals.rs:158:

Signal Types

Reinforcement Learning Strategy

Uses RL agents for adaptive trading. Basic structure:

Custom Strategy Example

Strategy Composition

Combine multiple strategies:

Best Practices

  1. Always use BaseStrategy for common functionality
  2. Keep state minimal - strategies should be lightweight
  3. Return orders, don’t execute - separation of concerns
  4. Check is_ready() before trading
  5. Handle all callbacks even if no-op
  6. Test in backtest first before live trading