Vectorized Environment
VecEnv runs many independent simulation episodes in parallel for
reinforcement learning.
Configuration
VecEnvConfig specifies the full environment:
| Field | Description |
|---|---|
mu, kappa, theta, sigma_v, rho | Heston parameters |
initial_price, initial_variance | Starting conditions |
spread, dt, max_steps | Simulation mechanics |
impact_factor | Price impact per unit filled |
k, a | Poisson matcher parameters |
hawkes_alpha, hawkes_beta | Hawkes intensity parameters |
initial_cash, transaction_cost | Agent capital |
reward_type | PnL or DiffSharpe |
inventory_penalty | Penalty for holding non-zero position |
matcher_dt | Sub-step resolution for the stochastic matcher |
State space
Each environment step produces a state vector of typically 6-8 elements:
- Mid-price.
- Current position (inventory).
- Time remaining.
- Spread.
- Volatility.
- Intensity (if Hawkes enabled).
Usage
#![allow(unused)] fn main() { use engine::vec_env::{VecEnv, VecEnvConfig, RewardType}; let config = VecEnvConfig { reward_type: RewardType::DiffSharpe, max_steps: 1000, ..Default::default() }; let mut env = VecEnv::new(config, 64); // 64 parallel environments // Reset to start new episodes. let states = env.reset(); // Step with actions. let actions = vec![0.5; 64]; // symmetric spread for all envs let (next_states, rewards, dones) = env.step(&actions); }