Skip to main content

SimulatedVenueConfigBuilder

Struct SimulatedVenueConfigBuilder 

Source
pub struct SimulatedVenueConfigBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build_inner().

Implementations§

Source§

impl<S: State> SimulatedVenueConfigBuilder<S>

Source

pub fn venue(self, value: Venue) -> SimulatedVenueConfigBuilder<SetVenue<S>>
where S::Venue: IsUnset,

Required.

The simulated venue identifier.

Source

pub fn oms_type( self, value: OmsType, ) -> SimulatedVenueConfigBuilder<SetOmsType<S>>
where S::OmsType: IsUnset,

Required.

The order management mode for position tracking.

Source

pub fn account_type( self, value: AccountType, ) -> SimulatedVenueConfigBuilder<SetAccountType<S>>
where S::AccountType: IsUnset,

Required.

The account type used for balance and margin calculations.

Source

pub fn book_type( self, value: BookType, ) -> SimulatedVenueConfigBuilder<SetBookType<S>>
where S::BookType: IsUnset,

Required.

The order book type used for matching.

Source

pub fn starting_balances( self, value: Vec<Money>, ) -> SimulatedVenueConfigBuilder<SetStartingBalances<S>>
where S::StartingBalances: IsUnset,

Required.

The initial account balances.

Source

pub fn base_currency( self, value: Currency, ) -> SimulatedVenueConfigBuilder<SetBaseCurrency<S>>
where S::BaseCurrency: IsUnset,

Optional (Some / Option setters). The account base currency, or None for a multi-currency account.

Source

pub fn maybe_base_currency( self, value: Option<Currency>, ) -> SimulatedVenueConfigBuilder<SetBaseCurrency<S>>
where S::BaseCurrency: IsUnset,

Optional (Some / Option setters). The account base currency, or None for a multi-currency account.

Source

pub fn default_leverage( self, value: Decimal, ) -> SimulatedVenueConfigBuilder<SetDefaultLeverage<S>>
where S::DefaultLeverage: IsUnset,

Optional (Some / Option setters). The default leverage, falling back to 10x for margin accounts and 1x otherwise.

Source

pub fn maybe_default_leverage( self, value: Option<Decimal>, ) -> SimulatedVenueConfigBuilder<SetDefaultLeverage<S>>
where S::DefaultLeverage: IsUnset,

Optional (Some / Option setters). The default leverage, falling back to 10x for margin accounts and 1x otherwise.

Source

pub fn leverages( self, value: AHashMap<InstrumentId, Decimal>, ) -> SimulatedVenueConfigBuilder<SetLeverages<S>>
where S::Leverages: IsUnset,

Optional (Some / Option setters). Default: <AHashMap<InstrumentId, Decimal> as Default>::default().

The leverage overrides for individual instruments.

Source

pub fn maybe_leverages( self, value: Option<AHashMap<InstrumentId, Decimal>>, ) -> SimulatedVenueConfigBuilder<SetLeverages<S>>
where S::Leverages: IsUnset,

Optional (Some / Option setters). Default: <AHashMap<InstrumentId, Decimal> as Default>::default().

The leverage overrides for individual instruments.

Source

pub fn margin_model( self, value: MarginModelHandle, ) -> SimulatedVenueConfigBuilder<SetMarginModel<S>>
where S::MarginModel: IsUnset,

Optional (Some / Option setters). The model used to calculate margin requirements.

Source

pub fn maybe_margin_model( self, value: Option<MarginModelHandle>, ) -> SimulatedVenueConfigBuilder<SetMarginModel<S>>
where S::MarginModel: IsUnset,

Optional (Some / Option setters). The model used to calculate margin requirements.

Source

pub fn modules( self, value: Vec<SimulationModuleHandle>, ) -> SimulatedVenueConfigBuilder<SetModules<S>>
where S::Modules: IsUnset,

Optional (Some / Option setters). Default: <Vec<SimulationModuleHandle> as Default>::default().

The simulation modules run by the exchange.

Source

pub fn maybe_modules( self, value: Option<Vec<SimulationModuleHandle>>, ) -> SimulatedVenueConfigBuilder<SetModules<S>>
where S::Modules: IsUnset,

Optional (Some / Option setters). Default: <Vec<SimulationModuleHandle> as Default>::default().

The simulation modules run by the exchange.

Source

pub fn fill_model( self, value: FillModelHandle, ) -> SimulatedVenueConfigBuilder<SetFillModel<S>>
where S::FillModel: IsUnset,

Optional (Some / Option setters). Default: <FillModelHandle as Default>::default().

The model used to simulate order fills.

Source

pub fn maybe_fill_model( self, value: Option<FillModelHandle>, ) -> SimulatedVenueConfigBuilder<SetFillModel<S>>
where S::FillModel: IsUnset,

Optional (Some / Option setters). Default: <FillModelHandle as Default>::default().

The model used to simulate order fills.

Source

pub fn fee_model( self, value: FeeModelHandle, ) -> SimulatedVenueConfigBuilder<SetFeeModel<S>>
where S::FeeModel: IsUnset,

Optional (Some / Option setters). Default: <FeeModelHandle as Default>::default().

The model used to calculate trading fees.

Source

pub fn maybe_fee_model( self, value: Option<FeeModelHandle>, ) -> SimulatedVenueConfigBuilder<SetFeeModel<S>>
where S::FeeModel: IsUnset,

Optional (Some / Option setters). Default: <FeeModelHandle as Default>::default().

The model used to calculate trading fees.

Source

pub fn latency_model( self, value: LatencyModelHandle, ) -> SimulatedVenueConfigBuilder<SetLatencyModel<S>>
where S::LatencyModel: IsUnset,

Optional (Some / Option setters). The optional model used to simulate command latency.

Source

pub fn maybe_latency_model( self, value: Option<LatencyModelHandle>, ) -> SimulatedVenueConfigBuilder<SetLatencyModel<S>>
where S::LatencyModel: IsUnset,

Optional (Some / Option setters). The optional model used to simulate command latency.

Source

pub fn routing(self, value: bool) -> SimulatedVenueConfigBuilder<SetRouting<S>>
where S::Routing: IsUnset,

Optional (Some / Option setters). Default: false.

If the execution client supports routing orders to other venues.

Source

pub fn maybe_routing( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetRouting<S>>
where S::Routing: IsUnset,

Optional (Some / Option setters). Default: false.

If the execution client supports routing orders to other venues.

Source

pub fn reject_stop_orders( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetRejectStopOrders<S>>
where S::RejectStopOrders: IsUnset,

Optional (Some / Option setters). Default: true.

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

Source

pub fn maybe_reject_stop_orders( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetRejectStopOrders<S>>
where S::RejectStopOrders: IsUnset,

Optional (Some / Option setters). Default: true.

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

Source

pub fn support_gtd_orders( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetSupportGtdOrders<S>>
where S::SupportGtdOrders: IsUnset,

Optional (Some / Option setters). Default: true.

If good-till-date order expiry is supported.

Source

pub fn maybe_support_gtd_orders( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetSupportGtdOrders<S>>
where S::SupportGtdOrders: IsUnset,

Optional (Some / Option setters). Default: true.

If good-till-date order expiry is supported.

Source

pub fn support_contingent_orders( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetSupportContingentOrders<S>>
where S::SupportContingentOrders: IsUnset,

Optional (Some / Option setters). Default: true.

If contingent order relationships are supported.

Source

pub fn maybe_support_contingent_orders( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetSupportContingentOrders<S>>
where S::SupportContingentOrders: IsUnset,

Optional (Some / Option setters). Default: true.

If contingent order relationships are supported.

Source

pub fn use_position_ids( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetUsePositionIds<S>>
where S::UsePositionIds: IsUnset,

Optional (Some / Option setters). Default: true.

If venue position IDs are generated.

Source

pub fn maybe_use_position_ids( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetUsePositionIds<S>>
where S::UsePositionIds: IsUnset,

Optional (Some / Option setters). Default: true.

If venue position IDs are generated.

Source

pub fn use_random_ids( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetUseRandomIds<S>>
where S::UseRandomIds: IsUnset,

Optional (Some / Option setters). Default: false.

If generated identifiers use random values instead of sequential counters.

Source

pub fn maybe_use_random_ids( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetUseRandomIds<S>>
where S::UseRandomIds: IsUnset,

Optional (Some / Option setters). Default: false.

If generated identifiers use random values instead of sequential counters.

Source

pub fn use_reduce_only( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetUseReduceOnly<S>>
where S::UseReduceOnly: IsUnset,

Optional (Some / Option setters). Default: true.

If reduce-only order restrictions are enforced.

Source

pub fn maybe_use_reduce_only( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetUseReduceOnly<S>>
where S::UseReduceOnly: IsUnset,

Optional (Some / Option setters). Default: true.

If reduce-only order restrictions are enforced.

Source

pub fn use_message_queue( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetUseMessageQueue<S>>
where S::UseMessageQueue: IsUnset,

Optional (Some / Option setters). Default: true.

If trading commands are queued instead of processed immediately.

Source

pub fn maybe_use_message_queue( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetUseMessageQueue<S>>
where S::UseMessageQueue: IsUnset,

Optional (Some / Option setters). Default: true.

If trading commands are queued instead of processed immediately.

Source

pub fn use_market_order_acks( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetUseMarketOrderAcks<S>>
where S::UseMarketOrderAcks: IsUnset,

Optional (Some / Option setters). Default: false.

If market orders emit acceptance events before filling.

Source

pub fn maybe_use_market_order_acks( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetUseMarketOrderAcks<S>>
where S::UseMarketOrderAcks: IsUnset,

Optional (Some / Option setters). Default: false.

If market orders emit acceptance events before filling.

Source

pub fn bar_execution( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetBarExecution<S>>
where S::BarExecution: IsUnset,

Optional (Some / Option setters). Default: true.

If bars drive order execution.

Source

pub fn maybe_bar_execution( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetBarExecution<S>>
where S::BarExecution: IsUnset,

Optional (Some / Option setters). Default: true.

If bars drive order execution.

Source

pub fn bar_adaptive_high_low_ordering( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetBarAdaptiveHighLowOrdering<S>>
where S::BarAdaptiveHighLowOrdering: IsUnset,

Optional (Some / Option setters). Default: false.

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

Source

pub fn maybe_bar_adaptive_high_low_ordering( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetBarAdaptiveHighLowOrdering<S>>
where S::BarAdaptiveHighLowOrdering: IsUnset,

Optional (Some / Option setters). Default: false.

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

Source

pub fn trade_execution( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetTradeExecution<S>>
where S::TradeExecution: IsUnset,

Optional (Some / Option setters). Default: true.

If trade ticks drive order execution.

Source

pub fn maybe_trade_execution( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetTradeExecution<S>>
where S::TradeExecution: IsUnset,

Optional (Some / Option setters). Default: true.

If trade ticks drive order execution.

Source

pub fn liquidity_consumption( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetLiquidityConsumption<S>>
where S::LiquidityConsumption: IsUnset,

Optional (Some / Option setters). Default: false.

If fills consume available liquidity.

Source

pub fn maybe_liquidity_consumption( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetLiquidityConsumption<S>>
where S::LiquidityConsumption: IsUnset,

Optional (Some / Option setters). Default: false.

If fills consume available liquidity.

Source

pub fn allow_cash_borrowing( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetAllowCashBorrowing<S>>
where S::AllowCashBorrowing: IsUnset,

Optional (Some / Option setters). Default: false.

If cash accounts may borrow funds.

Source

pub fn maybe_allow_cash_borrowing( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetAllowCashBorrowing<S>>
where S::AllowCashBorrowing: IsUnset,

Optional (Some / Option setters). Default: false.

If cash accounts may borrow funds.

Source

pub fn frozen_account( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetFrozenAccount<S>>
where S::FrozenAccount: IsUnset,

Optional (Some / Option setters). Default: false.

If account balances remain unchanged by simulated trading.

Source

pub fn maybe_frozen_account( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetFrozenAccount<S>>
where S::FrozenAccount: IsUnset,

Optional (Some / Option setters). Default: false.

If account balances remain unchanged by simulated trading.

Source

pub fn queue_position( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetQueuePosition<S>>
where S::QueuePosition: IsUnset,

Optional (Some / Option setters). Default: false.

If passive fills account for queue position.

Source

pub fn maybe_queue_position( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetQueuePosition<S>>
where S::QueuePosition: IsUnset,

Optional (Some / Option setters). Default: false.

If passive fills account for queue position.

Source

pub fn oto_full_trigger( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetOtoFullTrigger<S>>
where S::OtoFullTrigger: IsUnset,

Optional (Some / Option setters). Default: false.

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

Source

pub fn maybe_oto_full_trigger( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetOtoFullTrigger<S>>
where S::OtoFullTrigger: IsUnset,

Optional (Some / Option setters). Default: false.

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

Source

pub fn defer_option_settlement( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetDeferOptionSettlement<S>>
where S::DeferOptionSettlement: IsUnset,

Optional (Some / Option setters). Default: true.

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

Source

pub fn maybe_defer_option_settlement( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetDeferOptionSettlement<S>>
where S::DeferOptionSettlement: IsUnset,

Optional (Some / Option setters). Default: true.

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

Source

pub fn price_protection_points( self, value: u32, ) -> SimulatedVenueConfigBuilder<SetPriceProtectionPoints<S>>
where S::PriceProtectionPoints: IsUnset,

Optional (Some / Option setters). Default: 0.

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

Source

pub fn maybe_price_protection_points( self, value: Option<u32>, ) -> SimulatedVenueConfigBuilder<SetPriceProtectionPoints<S>>
where S::PriceProtectionPoints: IsUnset,

Optional (Some / Option setters). Default: 0.

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

Source

pub fn liquidation_enabled( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetLiquidationEnabled<S>>
where S::LiquidationEnabled: IsUnset,

Optional (Some / Option setters). Default: false.

If positions are liquidated when maintenance margin is breached.

Source

pub fn maybe_liquidation_enabled( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetLiquidationEnabled<S>>
where S::LiquidationEnabled: IsUnset,

Optional (Some / Option setters). Default: false.

If positions are liquidated when maintenance margin is breached.

Source

pub fn liquidation_trigger_ratio( self, value: f64, ) -> SimulatedVenueConfigBuilder<SetLiquidationTriggerRatio<S>>
where S::LiquidationTriggerRatio: IsUnset,

Optional (Some / Option setters). Default: 1.0.

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

Source

pub fn maybe_liquidation_trigger_ratio( self, value: Option<f64>, ) -> SimulatedVenueConfigBuilder<SetLiquidationTriggerRatio<S>>
where S::LiquidationTriggerRatio: IsUnset,

Optional (Some / Option setters). Default: 1.0.

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

Source

pub fn liquidation_cancel_open_orders( self, value: bool, ) -> SimulatedVenueConfigBuilder<SetLiquidationCancelOpenOrders<S>>
where S::LiquidationCancelOpenOrders: IsUnset,

Optional (Some / Option setters). Default: true.

If open orders are canceled before liquidating positions.

Source

pub fn maybe_liquidation_cancel_open_orders( self, value: Option<bool>, ) -> SimulatedVenueConfigBuilder<SetLiquidationCancelOpenOrders<S>>
where S::LiquidationCancelOpenOrders: IsUnset,

Optional (Some / Option setters). Default: true.

If open orders are canceled before liquidating positions.

Source§

impl<S: IsComplete> SimulatedVenueConfigBuilder<S>

Source

pub fn build(self) -> ConfigResult<SimulatedVenueConfig>

Validates and builds the SimulatedVenueConfig.

§Errors

Returns a ConfigError if any field fails validation (see SimulatedVenueConfig::validate).

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