Skip to main content

SimulatedVenueConfig

Struct SimulatedVenueConfig 

Source
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: Venue

The simulated venue identifier.

§oms_type: OmsType

The order management mode for position tracking.

§account_type: AccountType

The account type used for balance and margin calculations.

§book_type: BookType

The 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: FillModelHandle

The model used to simulate order fills.

§fee_model: FeeModelHandle

The model used to calculate trading fees.

§latency_model: Option<LatencyModelHandle>

The optional model used to simulate command latency.

§routing: bool

If the execution client supports routing orders to other venues.

§reject_stop_orders: bool

If stop orders already in the market are rejected on submission.

§support_gtd_orders: bool

If good-till-date order expiry is supported.

§support_contingent_orders: bool

If contingent order relationships are supported.

§use_position_ids: bool

If venue position IDs are generated.

§use_random_ids: bool

If generated identifiers use random values instead of sequential counters.

§use_reduce_only: bool

If reduce-only order restrictions are enforced.

§use_message_queue: bool

If trading commands are queued instead of processed immediately.

§use_market_order_acks: bool

If market orders emit acceptance events before filling.

§bar_execution: bool

If bars drive order execution.

§bar_adaptive_high_low_ordering: bool

If bar execution visits the high or low closest to the open first.

§trade_execution: bool

If trade ticks drive order execution.

§liquidity_consumption: bool

If fills consume available liquidity.

§allow_cash_borrowing: bool

If cash accounts may borrow funds.

§frozen_account: bool

If account balances remain unchanged by simulated trading.

§queue_position: bool

If passive fills account for queue position.

§oto_full_trigger: bool

If one-triggers-other orders wait for the parent to fill completely.

§defer_option_settlement: bool

If option settlement waits for expiry processing after same-timestamp market data.

§price_protection_points: u32

The market order price protection distance in ticks, or zero to disable protection.

§liquidation_enabled: bool

If positions are liquidated when maintenance margin is breached.

§liquidation_trigger_ratio: f64

The equity-to-maintenance-margin ratio at or below which liquidation triggers.

§liquidation_cancel_open_orders: bool

If open orders are canceled before liquidating positions.

Implementations§

Source§

impl SimulatedVenueConfig

Source

pub fn builder() -> SimulatedVenueConfigBuilder

Create an instance of SimulatedVenueConfig using the builder syntax

Source§

impl SimulatedVenueConfig

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V