bot-engine 0.1.0

Trading bot engine: order manager, inventory, event routing
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Simulation Layer: Shared margin-aware accounting for paper trading and backtesting.
//!
//! This module provides accurate perpetual futures simulation including:
//! - Per-instrument isolated margin positions
//! - Margin-aware order admission (instead of full-notional checks)
//! - Proper fill settlement with margin reserve/release
//! - Unrealized PnL tracking at mark prices
//! - Liquidation price computation
//!
//! Used by `PaperExchange` to provide realistic simulation that matches
//! how Hyperliquid actually handles margin and positions.
//!
//! **Note**: This module is ONLY used in the simulation path (paper/backtest).
//! Live trading uses the real exchange which handles all margin math server-side.

pub mod account;

pub use account::{IsolatedPosition, MarginLedger};