Skip to main content

StrategyConfigBuilder

Struct StrategyConfigBuilder 

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

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

Implementations§

Source§

impl<S: State> StrategyConfigBuilder<S>

Source

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

Finish building and return the requested object

Source

pub fn strategy_id( self, value: StrategyId, ) -> StrategyConfigBuilder<SetStrategyId<S>>
where S::StrategyId: IsUnset,

Optional (Some / Option setters). The unique ID for the strategy. Will become the strategy ID if not None.

Source

pub fn maybe_strategy_id( self, value: Option<StrategyId>, ) -> StrategyConfigBuilder<SetStrategyId<S>>
where S::StrategyId: IsUnset,

Optional (Some / Option setters). The unique ID for the strategy. Will become the strategy ID if not None.

Source

pub fn order_id_tag( self, value: String, ) -> StrategyConfigBuilder<SetOrderIdTag<S>>
where S::OrderIdTag: IsUnset,

Optional (Some / Option setters). The unique order ID tag for the strategy. Must be unique amongst all running strategies for a particular trader ID.

Source

pub fn maybe_order_id_tag( self, value: Option<String>, ) -> StrategyConfigBuilder<SetOrderIdTag<S>>
where S::OrderIdTag: IsUnset,

Optional (Some / Option setters). The unique order ID tag for the strategy. Must be unique amongst all running strategies for a particular trader ID.

Source

pub fn use_uuid_client_order_ids( self, value: bool, ) -> StrategyConfigBuilder<SetUseUuidClientOrderIds<S>>
where S::UseUuidClientOrderIds: IsUnset,

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

If UUID4’s should be used for client order ID values.

Source

pub fn maybe_use_uuid_client_order_ids( self, value: Option<bool>, ) -> StrategyConfigBuilder<SetUseUuidClientOrderIds<S>>
where S::UseUuidClientOrderIds: IsUnset,

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

If UUID4’s should be used for client order ID values.

Source

pub fn use_hyphens_in_client_order_ids( self, value: bool, ) -> StrategyConfigBuilder<SetUseHyphensInClientOrderIds<S>>
where S::UseHyphensInClientOrderIds: IsUnset,

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

If hyphens should be used in generated client order ID values.

Source

pub fn maybe_use_hyphens_in_client_order_ids( self, value: Option<bool>, ) -> StrategyConfigBuilder<SetUseHyphensInClientOrderIds<S>>
where S::UseHyphensInClientOrderIds: IsUnset,

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

If hyphens should be used in generated client order ID values.

Source

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

Optional (Some / Option setters). The order management system type for the strategy. This will determine how the ExecutionEngine handles position IDs.

Source

pub fn maybe_oms_type( self, value: Option<OmsType>, ) -> StrategyConfigBuilder<SetOmsType<S>>
where S::OmsType: IsUnset,

Optional (Some / Option setters). The order management system type for the strategy. This will determine how the ExecutionEngine handles position IDs.

Source

pub fn external_order_claims( self, value: Vec<InstrumentId>, ) -> StrategyConfigBuilder<SetExternalOrderClaims<S>>
where S::ExternalOrderClaims: IsUnset,

Optional (Some / Option setters). The external order claim instrument IDs. External orders for matching instrument IDs will be associated with (claimed by) the strategy.

Source

pub fn maybe_external_order_claims( self, value: Option<Vec<InstrumentId>>, ) -> StrategyConfigBuilder<SetExternalOrderClaims<S>>
where S::ExternalOrderClaims: IsUnset,

Optional (Some / Option setters). The external order claim instrument IDs. External orders for matching instrument IDs will be associated with (claimed by) the strategy.

Source

pub fn manage_contingent_orders( self, value: bool, ) -> StrategyConfigBuilder<SetManageContingentOrders<S>>
where S::ManageContingentOrders: IsUnset,

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

If OTO, OCO, and OUO open contingent orders should be managed automatically by the strategy. Any emulated orders which are active local will be managed by the OrderEmulator instead.

Source

pub fn maybe_manage_contingent_orders( self, value: Option<bool>, ) -> StrategyConfigBuilder<SetManageContingentOrders<S>>
where S::ManageContingentOrders: IsUnset,

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

If OTO, OCO, and OUO open contingent orders should be managed automatically by the strategy. Any emulated orders which are active local will be managed by the OrderEmulator instead.

Source

pub fn manage_gtd_expiry( self, value: bool, ) -> StrategyConfigBuilder<SetManageGtdExpiry<S>>
where S::ManageGtdExpiry: IsUnset,

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

If all order GTD time in force expirations should be managed by the strategy. If True, then will ensure open orders have their GTD timers re-activated on start.

Source

pub fn maybe_manage_gtd_expiry( self, value: Option<bool>, ) -> StrategyConfigBuilder<SetManageGtdExpiry<S>>
where S::ManageGtdExpiry: IsUnset,

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

If all order GTD time in force expirations should be managed by the strategy. If True, then will ensure open orders have their GTD timers re-activated on start.

Source

pub fn manage_stop(self, value: bool) -> StrategyConfigBuilder<SetManageStop<S>>
where S::ManageStop: IsUnset,

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

If the strategy should automatically perform a market exit when stopped. If true, calling stop() will first cancel all orders and close all positions before the strategy transitions to the STOPPED state.

Source

pub fn maybe_manage_stop( self, value: Option<bool>, ) -> StrategyConfigBuilder<SetManageStop<S>>
where S::ManageStop: IsUnset,

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

If the strategy should automatically perform a market exit when stopped. If true, calling stop() will first cancel all orders and close all positions before the strategy transitions to the STOPPED state.

Source

pub fn market_exit_interval_ms( self, value: u64, ) -> StrategyConfigBuilder<SetMarketExitIntervalMs<S>>
where S::MarketExitIntervalMs: IsUnset,

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

The interval in milliseconds to check for in-flight orders and open positions during a market exit.

Source

pub fn maybe_market_exit_interval_ms( self, value: Option<u64>, ) -> StrategyConfigBuilder<SetMarketExitIntervalMs<S>>
where S::MarketExitIntervalMs: IsUnset,

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

The interval in milliseconds to check for in-flight orders and open positions during a market exit.

Source

pub fn market_exit_max_attempts( self, value: u64, ) -> StrategyConfigBuilder<SetMarketExitMaxAttempts<S>>
where S::MarketExitMaxAttempts: IsUnset,

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

The maximum number of attempts to wait for orders and positions to close during a market exit before completing. Defaults to 100 attempts (10 seconds at 100ms intervals).

Source

pub fn maybe_market_exit_max_attempts( self, value: Option<u64>, ) -> StrategyConfigBuilder<SetMarketExitMaxAttempts<S>>
where S::MarketExitMaxAttempts: IsUnset,

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

The maximum number of attempts to wait for orders and positions to close during a market exit before completing. Defaults to 100 attempts (10 seconds at 100ms intervals).

Source

pub fn market_exit_time_in_force( self, value: TimeInForce, ) -> StrategyConfigBuilder<SetMarketExitTimeInForce<S>>
where S::MarketExitTimeInForce: IsUnset,

Optional (Some / Option setters). Default: TimeInForce::Gtc.

The time in force for closing market orders during a market exit.

Source

pub fn maybe_market_exit_time_in_force( self, value: Option<TimeInForce>, ) -> StrategyConfigBuilder<SetMarketExitTimeInForce<S>>
where S::MarketExitTimeInForce: IsUnset,

Optional (Some / Option setters). Default: TimeInForce::Gtc.

The time in force for closing market orders during a market exit.

Source

pub fn market_exit_reduce_only( self, value: bool, ) -> StrategyConfigBuilder<SetMarketExitReduceOnly<S>>
where S::MarketExitReduceOnly: IsUnset,

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

If closing market orders during a market exit should be reduce only.

Source

pub fn maybe_market_exit_reduce_only( self, value: Option<bool>, ) -> StrategyConfigBuilder<SetMarketExitReduceOnly<S>>
where S::MarketExitReduceOnly: IsUnset,

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

If closing market orders during a market exit should be reduce only.

Source

pub fn log_events(self, value: bool) -> StrategyConfigBuilder<SetLogEvents<S>>
where S::LogEvents: IsUnset,

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

If events should be logged by the strategy. If False, then only warning events and above are logged.

Source

pub fn maybe_log_events( self, value: Option<bool>, ) -> StrategyConfigBuilder<SetLogEvents<S>>
where S::LogEvents: IsUnset,

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

If events should be logged by the strategy. If False, then only warning events and above are logged.

Source

pub fn log_commands( self, value: bool, ) -> StrategyConfigBuilder<SetLogCommands<S>>
where S::LogCommands: IsUnset,

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

If commands should be logged by the strategy.

Source

pub fn maybe_log_commands( self, value: Option<bool>, ) -> StrategyConfigBuilder<SetLogCommands<S>>
where S::LogCommands: IsUnset,

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

If commands should be logged by the strategy.

Source

pub fn log_rejected_due_post_only_as_warning( self, value: bool, ) -> StrategyConfigBuilder<SetLogRejectedDuePostOnlyAsWarning<S>>
where S::LogRejectedDuePostOnlyAsWarning: IsUnset,

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

If order rejected events where due_post_only is True should be logged as warnings.

Source

pub fn maybe_log_rejected_due_post_only_as_warning( self, value: Option<bool>, ) -> StrategyConfigBuilder<SetLogRejectedDuePostOnlyAsWarning<S>>
where S::LogRejectedDuePostOnlyAsWarning: IsUnset,

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

If order rejected events where due_post_only is True should be logged as warnings.

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
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<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> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

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