Overview
TheTradingConfig struct defines configuration parameters for trading operations, including instrument selection, position limits, and capital allocation.
Source: nano-gateway/src/config.rs
TradingConfig
Fields
| Field | Type | Default | Description |
|---|---|---|---|
live_enabled | bool | false | Enable live trading (vs paper trading) |
symbols | Vec<String> | ["ESH24"] | Instrument symbols to trade |
initial_capital | f64 | 1,000,000.0 | Starting capital in dollars |
max_position | i64 | 50 | Maximum net position per instrument |
max_order_size | u32 | 10 | Maximum single order size |
Constructor
default
Creates a default trading configuration suitable for paper trading.
- 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
Configuration Examples
Paper Trading Configuration
Safe configuration for testing strategies without real money.Live Trading Configuration
Configuration for live trading with real capital.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 senttrue: Live trading mode - orders sent to exchange
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 futuresYMH24,YMM24, etc.: Dow E-mini futuresRTYM24,RTYU24, etc.: Russell 2000 E-mini futures
initial_capital
Starting capital available for trading. Units: US Dollars Usage:- Position sizing calculations
- Risk management (percentage of capital)
- Performance reporting (returns)
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:- 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
- 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
NANOARB_CONFIG environment variable or uses defaults.
Example TOML Config
Validation
Always validate configuration before use:Complete Example
See Also
- RiskConfig - Risk management configuration
- BacktestConfig - Backtest configuration