Skip to main content

Overview

The TradingConfig struct defines configuration parameters for trading operations, including instrument selection, position limits, and capital allocation. Source: nano-gateway/src/config.rs

TradingConfig

Fields

Constructor

default

Creates a default trading configuration suitable for paper trading.
Defaults:
  • Paper trading mode (live_enabled: false)
  • Single ES future contract (ESH24)
  • $1M initial capital
  • Conservative position limits (50 contracts max)
  • Order size limit of 10 contracts
Example:

Configuration Examples

Paper Trading Configuration

Safe configuration for testing strategies without real money.

Live Trading Configuration

Configuration for live trading with real capital.
Warning: Always start with small position limits when going live.

Multi-Instrument Configuration

Trading multiple instruments simultaneously.

HFT Configuration

Optimized for high-frequency trading.

Field Details

live_enabled

Controls whether orders are sent to live exchange or simulated. Values:
  • false (default): Paper trading mode - no real orders sent
  • true: Live trading mode - orders sent to exchange
Safety: Always test strategies thoroughly in paper mode before enabling live trading. Example:

symbols

List of instrument symbols to trade. Format: CME symbol format (e.g., “ESH24” = ES March 2024 contract) Common Symbols:
  • ESH24, ESM24, ESU24, ESZ24: S&P 500 E-mini futures (H=Mar, M=Jun, U=Sep, Z=Dec)
  • NQH24, NQM24, etc.: Nasdaq 100 E-mini futures
  • YMH24, YMM24, etc.: Dow E-mini futures
  • RTYM24, RTYU24, etc.: Russell 2000 E-mini futures
Example:

initial_capital

Starting capital available for trading. Units: US Dollars Usage:
  • Position sizing calculations
  • Risk management (percentage of capital)
  • Performance reporting (returns)
Example:

max_position

Maximum net position size per instrument. Units: Contracts (can be positive or negative) Range: Symmetric around zero (e.g., max_position=50 means -50 to +50) Enforcement: Checked before order submission by risk manager Example:
Typical Values:
  • Conservative: 10-20 contracts
  • Moderate: 50-100 contracts
  • Aggressive: 100-500 contracts

max_order_size

Maximum size for a single order. Units: Contracts Purpose:
  • Prevents accidental large orders
  • Manages market impact
  • Controls execution risk
Example:
Typical Values:
  • Retail: 1-5 contracts
  • Small firm: 5-20 contracts
  • HFT: 20-100 contracts

AppConfig Integration

TradingConfig is typically embedded in the larger AppConfig structure.

Loading Configuration

From File

From Environment

Reads from NANOARB_CONFIG environment variable or uses defaults.

Example TOML Config

Validation

Always validate configuration before use:

Complete Example

See Also