Skip to main content

GridMarketMakerConfigBuilder

Struct GridMarketMakerConfigBuilder 

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

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

Implementations§

Source§

impl<S: State> GridMarketMakerConfigBuilder<S>

Source

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

Finish building and return the requested object

Source

pub fn base( self, value: StrategyConfig, ) -> GridMarketMakerConfigBuilder<SetBase<S>>
where S::Base: IsUnset,

Optional (Some / Option setters). Default:

StrategyConfig {
    strategy_id: Some(StrategyId::from("GRID_MM-001")),
    order_id_tag: Some("001".to_string()),
    ..Default::default()
}

Base strategy configuration.

Source

pub fn maybe_base( self, value: Option<StrategyConfig>, ) -> GridMarketMakerConfigBuilder<SetBase<S>>
where S::Base: IsUnset,

Optional (Some / Option setters). Default:

StrategyConfig {
    strategy_id: Some(StrategyId::from("GRID_MM-001")),
    order_id_tag: Some("001".to_string()),
    ..Default::default()
}

Base strategy configuration.

Source

pub fn instrument_id( self, value: InstrumentId, ) -> GridMarketMakerConfigBuilder<SetInstrumentId<S>>
where S::InstrumentId: IsUnset,

Required.

Instrument ID to trade.

Source

pub fn trade_size( self, value: Quantity, ) -> GridMarketMakerConfigBuilder<SetTradeSize<S>>
where S::TradeSize: IsUnset,

Optional (Some / Option setters). Trade size per grid level. When None the strategy resolves it from the instrument’s min_quantity during on_start.

Source

pub fn maybe_trade_size( self, value: Option<Quantity>, ) -> GridMarketMakerConfigBuilder<SetTradeSize<S>>
where S::TradeSize: IsUnset,

Optional (Some / Option setters). Trade size per grid level. When None the strategy resolves it from the instrument’s min_quantity during on_start.

Source

pub fn num_levels( self, value: usize, ) -> GridMarketMakerConfigBuilder<SetNumLevels<S>>
where S::NumLevels: IsUnset,

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

Number of price levels on each side (buy & sell).

Source

pub fn maybe_num_levels( self, value: Option<usize>, ) -> GridMarketMakerConfigBuilder<SetNumLevels<S>>
where S::NumLevels: IsUnset,

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

Number of price levels on each side (buy & sell).

Source

pub fn grid_step_bps( self, value: u32, ) -> GridMarketMakerConfigBuilder<SetGridStepBps<S>>
where S::GridStepBps: IsUnset,

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

Grid spacing in basis points of mid-price (geometric grid). E.g. 10 = 10 bps = 0.1%. Buy level N = mid × (1 - bps/10000)^N.

Source

pub fn maybe_grid_step_bps( self, value: Option<u32>, ) -> GridMarketMakerConfigBuilder<SetGridStepBps<S>>
where S::GridStepBps: IsUnset,

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

Grid spacing in basis points of mid-price (geometric grid). E.g. 10 = 10 bps = 0.1%. Buy level N = mid × (1 - bps/10000)^N.

Source

pub fn skew_factor( self, value: f64, ) -> GridMarketMakerConfigBuilder<SetSkewFactor<S>>
where S::SkewFactor: IsUnset,

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

How aggressively to shift the grid based on inventory.

Source

pub fn maybe_skew_factor( self, value: Option<f64>, ) -> GridMarketMakerConfigBuilder<SetSkewFactor<S>>
where S::SkewFactor: IsUnset,

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

How aggressively to shift the grid based on inventory.

Source

pub fn max_position( self, value: Quantity, ) -> GridMarketMakerConfigBuilder<SetMaxPosition<S>>
where S::MaxPosition: IsUnset,

Required.

Hard cap on net exposure (long or short).

Source

pub fn requote_threshold_bps( self, value: u32, ) -> GridMarketMakerConfigBuilder<SetRequoteThresholdBps<S>>
where S::RequoteThresholdBps: IsUnset,

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

Minimum mid-price move in basis points before re-quoting. E.g. 5 = 5 bps = 0.05%.

Source

pub fn maybe_requote_threshold_bps( self, value: Option<u32>, ) -> GridMarketMakerConfigBuilder<SetRequoteThresholdBps<S>>
where S::RequoteThresholdBps: IsUnset,

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

Minimum mid-price move in basis points before re-quoting. E.g. 5 = 5 bps = 0.05%.

Source

pub fn expire_time_secs( self, value: u64, ) -> GridMarketMakerConfigBuilder<SetExpireTimeSecs<S>>
where S::ExpireTimeSecs: IsUnset,

Optional (Some / Option setters). Optional order expiry in seconds. When set, orders use GTD time-in-force with expire_time = now + expire_time_secs.

Source

pub fn maybe_expire_time_secs( self, value: Option<u64>, ) -> GridMarketMakerConfigBuilder<SetExpireTimeSecs<S>>
where S::ExpireTimeSecs: IsUnset,

Optional (Some / Option setters). Optional order expiry in seconds. When set, orders use GTD time-in-force with expire_time = now + expire_time_secs.

Source

pub fn on_cancel_resubmit( self, value: bool, ) -> GridMarketMakerConfigBuilder<SetOnCancelResubmit<S>>
where S::OnCancelResubmit: IsUnset,

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

When true, resubmit the full grid on the next quote after receiving an order cancel event. Useful for exchanges like dYdX where short-term orders are canceled by the protocol after expiry.

Source

pub fn maybe_on_cancel_resubmit( self, value: Option<bool>, ) -> GridMarketMakerConfigBuilder<SetOnCancelResubmit<S>>
where S::OnCancelResubmit: IsUnset,

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

When true, resubmit the full grid on the next quote after receiving an order cancel event. Useful for exchanges like dYdX where short-term orders are canceled by the protocol after expiry.

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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
§

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

§

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.

§

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.

§

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 = 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> Ungil for T
where T: Send,

§

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