Skip to main content

BacktestVenueConfigBuilder

Struct BacktestVenueConfigBuilder 

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

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

Implementations§

Source§

impl<S: State> BacktestVenueConfigBuilder<S>

Source

pub fn build(self) -> BacktestVenueConfig
where S: IsComplete,

Finish building and return the requested object

Source

pub fn name(self, value: Ustr) -> BacktestVenueConfigBuilder<SetName<S>>
where S::Name: IsUnset,

Required.

The name of the venue.

Source

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

Required.

The order management system type for the exchange. If HEDGING will generate new position IDs.

Source

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

Required.

The account type for the exchange.

Source

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

Required.

The default order book type.

Source

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

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

The starting account balances (specify one for a single asset account).

Source

pub fn maybe_starting_balances( self, value: Option<Vec<String>>, ) -> BacktestVenueConfigBuilder<SetStartingBalances<S>>
where S::StartingBalances: IsUnset,

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

The starting account balances (specify one for a single asset account).

Source

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

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

If multi-venue routing should be enabled for the execution client.

Source

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

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

If multi-venue routing should be enabled for the execution client.

Source

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

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

If the account for this exchange is frozen (balances will not change).

Source

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

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

If the account for this exchange is frozen (balances will not change).

Source

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

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

If stop orders are rejected on submission if trigger price is in the market.

Source

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

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

If stop orders are rejected on submission if trigger price is in the market.

Source

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

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

If orders with GTD time in force will be supported by the venue.

Source

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

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

If orders with GTD time in force will be supported by the venue.

Source

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

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

If contingent orders will be supported/respected by the venue. If False, then it’s expected the strategy will be managing any contingent orders.

Source

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

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

If contingent orders will be supported/respected by the venue. If False, then it’s expected the strategy will be managing any contingent orders.

Source

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

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

If venue position IDs will be generated on order fills.

Source

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

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

If venue position IDs will be generated on order fills.

Source

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

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

If venue order IDs and position IDs will be random UUID4’s. Trade IDs are always deterministic and not affected by this flag.

Source

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

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

If venue order IDs and position IDs will be random UUID4’s. Trade IDs are always deterministic and not affected by this flag.

Source

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

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

If the reduce_only execution instruction on orders will be honored.

Source

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

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

If the reduce_only execution instruction on orders will be honored.

Source

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

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

If bars should be processed by the matching engine(s) (and move the market).

Source

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

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

If bars should be processed by the matching engine(s) (and move the market).

Source

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

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

Determines whether the processing order of bar prices is adaptive based on a heuristic. This setting is only relevant when bar_execution is True. If False, bar prices are always processed in the fixed order: Open, High, Low, Close. If True, the processing order adapts with the heuristic:

  • If High is closer to Open than Low then the processing order is Open, High, Low, Close.
  • If Low is closer to Open than High then the processing order is Open, Low, High, Close.
Source

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

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

Determines whether the processing order of bar prices is adaptive based on a heuristic. This setting is only relevant when bar_execution is True. If False, bar prices are always processed in the fixed order: Open, High, Low, Close. If True, the processing order adapts with the heuristic:

  • If High is closer to Open than Low then the processing order is Open, High, Low, Close.
  • If Low is closer to Open than High then the processing order is Open, Low, High, Close.
Source

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

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

If trades should be processed by the matching engine(s) (and move the market).

Source

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

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

If trades should be processed by the matching engine(s) (and move the market).

Source

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

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

If OrderAccepted events should be generated for market orders.

Source

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

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

If OrderAccepted events should be generated for market orders.

Source

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

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

If order book liquidity consumption should be tracked per level.

Source

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

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

If order book liquidity consumption should be tracked per level.

Source

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

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

If negative cash balances are allowed (borrowing).

Source

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

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

If negative cash balances are allowed (borrowing).

Source

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

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

If limit order queue position tracking is enabled during trade execution.

Source

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

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

If limit order queue position tracking is enabled during trade execution.

Source

pub fn oto_trigger_mode( self, value: OtoTriggerMode, ) -> BacktestVenueConfigBuilder<SetOtoTriggerMode<S>>
where S::OtoTriggerMode: IsUnset,

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

When OTO child orders are released relative to parent fills.

Source

pub fn maybe_oto_trigger_mode( self, value: Option<OtoTriggerMode>, ) -> BacktestVenueConfigBuilder<SetOtoTriggerMode<S>>
where S::OtoTriggerMode: IsUnset,

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

When OTO child orders are released relative to parent fills.

Source

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

Optional (Some / Option setters). The account base currency for the exchange. Use None for multi-currency accounts.

Source

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

Optional (Some / Option setters). The account base currency for the exchange. Use None for multi-currency accounts.

Source

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

Optional (Some / Option setters). Default: Decimal::ONE.

The account default leverage (for margin accounts).

Source

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

Optional (Some / Option setters). Default: Decimal::ONE.

The account default leverage (for margin accounts).

Source

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

Optional (Some / Option setters). The instrument specific leverage configuration (for margin accounts).

Source

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

Optional (Some / Option setters). The instrument specific leverage configuration (for margin accounts).

Source

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

Optional (Some / Option setters). The margin model for the venue.

Source

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

Optional (Some / Option setters). The margin model for the venue.

Source

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

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

The simulation modules for the venue.

Source

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

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

The simulation modules for the venue.

Source

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

Optional (Some / Option setters). The fill model for the venue.

Source

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

Optional (Some / Option setters). The fill model for the venue.

Source

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

Optional (Some / Option setters). The latency model for the venue.

Source

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

Optional (Some / Option setters). The latency model for the venue.

Source

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

Optional (Some / Option setters). The fee model for the venue.

Source

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

Optional (Some / Option setters). The fee model for the venue.

Source

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

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

Defines an exchange-calculated price boundary to prevent a market order from being filled at an extremely aggressive price.

Source

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

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

Defines an exchange-calculated price boundary to prevent a market order from being filled at an extremely aggressive price.

Source

pub fn settlement_prices( self, value: AHashMap<InstrumentId, f64>, ) -> BacktestVenueConfigBuilder<SetSettlementPrices<S>>
where S::SettlementPrices: IsUnset,

Optional (Some / Option setters). Settlement prices for expiring instruments keyed by instrument ID.

Source

pub fn maybe_settlement_prices( self, value: Option<AHashMap<InstrumentId, f64>>, ) -> BacktestVenueConfigBuilder<SetSettlementPrices<S>>
where S::SettlementPrices: IsUnset,

Optional (Some / Option setters). Settlement prices for expiring instruments keyed by instrument ID.

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Ungil for T
where T: Send,