Expand description
Generic Simulation Engine
This module provides a domain-agnostic simulation engine that can be used for any kind of event-driven processing over time series data.
The engine is designed to be:
- Domain-agnostic: No knowledge of finance, IoT, or any specific domain
- Composable: Can be wrapped by domain-specific engines
- Efficient: Supports batch and streaming modes
Finance-specific features like position tracking, fill simulation, and P&L calculation should be implemented in Shape stdlib, not here.
§High-Performance Mode (TypedObject)
For maximum performance (>10M ticks/sec), simulation state should be a
TypedObject - a fixed-layout object created from a type declaration.
Use require_typed_state() to enforce this at runtime.
type BacktestState {
cash: f64,
position: f64,
entry_price: f64
}
let state = BacktestState { cash: 100000.0, position: 0.0, entry_price: 0.0 }
simulate(data, state, strategy) // state will use TypedObject optimizationRe-exports§
pub use validation::require_typed_state_with_schema;pub use validation::validate_typed_state;pub use engine::SimulationEngine;pub use engine::SimulationEngineConfig;pub use engine::SimulationEngineResult;pub use engine::SimulationEvent;pub use engine::SimulationMode;pub use engine::StepHandler;pub use engine::StepResult;pub use dense_kernel::DenseKernel;pub use dense_kernel::DenseKernelConfig;pub use dense_kernel::DenseKernelResult;pub use dense_kernel::KernelCompileConfig;pub use dense_kernel::KernelCompiler;pub use dense_kernel::SimulationKernelFn;pub use dense_kernel::simulate;pub use correlated_kernel::TableSchema;pub use event_scheduler::EventQueue;pub use event_scheduler::ScheduledEvent;pub use hybrid_kernel::EventHandlerFn;pub use hybrid_kernel::HybridKernel;pub use hybrid_kernel::HybridKernelConfig;pub use hybrid_kernel::HybridKernelResult;pub use hybrid_kernel::simulate_hybrid;pub use parallel::ParallelSweepResult;pub use parallel::par_run;pub use parallel::par_run_with_config;pub use parallel::param_grid;pub use parallel::param_grid3;
Modules§
- correlated_
kernel - CorrelatedKernel - Multi-Table Simulation
- dense_
kernel - DenseKernel - High-Performance Simulation Hot Loop
- engine
- Generic Simulation Engine
- event_
scheduler - EventQueue - Discrete Event Scheduling
- hybrid_
kernel - HybridKernel - Event-Driven Simulation
- parallel
- Parallel Parameter Sweeps
- validation
- TypedObject Validation for High-Performance Simulation