pub struct SimulatedVenueConfig {Show 35 fields
pub venue: Venue,
pub oms_type: OmsType,
pub account_type: AccountType,
pub book_type: BookType,
pub starting_balances: Vec<Money>,
pub base_currency: Option<Currency>,
pub default_leverage: Option<Decimal>,
pub leverages: AHashMap<InstrumentId, Decimal>,
pub margin_model: Option<MarginModelHandle>,
pub modules: Vec<SimulationModuleHandle>,
pub fill_model: FillModelHandle,
pub fee_model: FeeModelHandle,
pub latency_model: Option<LatencyModelHandle>,
pub routing: bool,
pub reject_stop_orders: bool,
pub support_gtd_orders: bool,
pub support_contingent_orders: bool,
pub use_position_ids: bool,
pub use_random_ids: bool,
pub use_reduce_only: bool,
pub use_message_queue: bool,
pub use_market_order_acks: bool,
pub bar_execution: bool,
pub bar_adaptive_high_low_ordering: bool,
pub trade_execution: bool,
pub liquidity_consumption: bool,
pub allow_cash_borrowing: bool,
pub frozen_account: bool,
pub queue_position: bool,
pub oto_full_trigger: bool,
pub defer_option_settlement: bool,
pub price_protection_points: u32,
pub liquidation_enabled: bool,
pub liquidation_trigger_ratio: f64,
pub liquidation_cancel_open_orders: bool,
}Expand description
Imperative-API configuration for registering a simulated venue on
crate::engine::BacktestEngine.
Constructed via bon::Builder so callers only specify what differs from
the documented defaults. Field types mirror the internal
SimulatedExchange shapes (runtime handles for modules and models,
and typed Money balances), which is why this is distinct from the
YAML-friendly BacktestVenueConfig used by BacktestNode.
§Option Settlement Deferral
With defer_option_settlement, the caller schedules expiration processing after
all market data at the expiry timestamp. This defaults to true; BacktestEngine
schedules the required expiry timers.
Cancellation and market closure remain immediate; explicit contract-close events bypass deferral, and automatic checks after expiry can also settle.
Fields§
§venue: VenueThe simulated venue identifier.
oms_type: OmsTypeThe order management mode for position tracking.
account_type: AccountTypeThe account type used for balance and margin calculations.
book_type: BookTypeThe order book type used for matching.
starting_balances: Vec<Money>The initial account balances.
base_currency: Option<Currency>The account base currency, or None for a multi-currency account.
default_leverage: Option<Decimal>The default leverage, falling back to 10x for margin accounts and 1x otherwise.
leverages: AHashMap<InstrumentId, Decimal>The leverage overrides for individual instruments.
margin_model: Option<MarginModelHandle>The model used to calculate margin requirements.
modules: Vec<SimulationModuleHandle>The simulation modules run by the exchange.
fill_model: FillModelHandleThe model used to simulate order fills.
fee_model: FeeModelHandleThe model used to calculate trading fees.
latency_model: Option<LatencyModelHandle>The optional model used to simulate command latency.
routing: boolIf the execution client supports routing orders to other venues.
reject_stop_orders: boolIf stop orders already in the market are rejected on submission.
support_gtd_orders: boolIf good-till-date order expiry is supported.
support_contingent_orders: boolIf contingent order relationships are supported.
use_position_ids: boolIf venue position IDs are generated.
use_random_ids: boolIf generated identifiers use random values instead of sequential counters.
use_reduce_only: boolIf reduce-only order restrictions are enforced.
use_message_queue: boolIf trading commands are queued instead of processed immediately.
use_market_order_acks: boolIf market orders emit acceptance events before filling.
bar_execution: boolIf bars drive order execution.
bar_adaptive_high_low_ordering: boolIf bar execution visits the high or low closest to the open first.
trade_execution: boolIf trade ticks drive order execution.
liquidity_consumption: boolIf fills consume available liquidity.
allow_cash_borrowing: boolIf cash accounts may borrow funds.
frozen_account: boolIf account balances remain unchanged by simulated trading.
queue_position: boolIf passive fills account for queue position.
oto_full_trigger: boolIf one-triggers-other orders wait for the parent to fill completely.
defer_option_settlement: boolIf option settlement waits for expiry processing after same-timestamp market data.
price_protection_points: u32The market order price protection distance in ticks, or zero to disable protection.
liquidation_enabled: boolIf positions are liquidated when maintenance margin is breached.
liquidation_trigger_ratio: f64The equity-to-maintenance-margin ratio at or below which liquidation triggers.
liquidation_cancel_open_orders: boolIf open orders are canceled before liquidating positions.
Implementations§
Source§impl SimulatedVenueConfig
impl SimulatedVenueConfig
Sourcepub fn builder() -> SimulatedVenueConfigBuilder
pub fn builder() -> SimulatedVenueConfigBuilder
Create an instance of SimulatedVenueConfig using the builder syntax
Source§impl SimulatedVenueConfig
impl SimulatedVenueConfig
Sourcepub fn validate(&self) -> ConfigResult<()>
pub fn validate(&self) -> ConfigResult<()>
Validates the venue configuration, collecting every field violation.
§Errors
Returns a ConfigError (a ConfigError::Multiple when more than one field is
invalid) if any field fails validation.
Auto Trait Implementations§
impl !RefUnwindSafe for SimulatedVenueConfig
impl !Send for SimulatedVenueConfig
impl !Sync for SimulatedVenueConfig
impl !UnwindSafe for SimulatedVenueConfig
impl Freeze for SimulatedVenueConfig
impl Unpin for SimulatedVenueConfig
impl UnsafeUnpin for SimulatedVenueConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more