Skip to main content

DeltaNeutralVolConfigBuilder

Struct DeltaNeutralVolConfigBuilder 

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

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

Implementations§

Source§

impl<S: State> DeltaNeutralVolConfigBuilder<S>

Source

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

Finish building and return the requested object

Source

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

Optional (Some / Option setters). Default:

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

Base strategy configuration.

Source

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

Optional (Some / Option setters). Default:

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

Base strategy configuration.

Source

pub fn option_family( self, value: String, ) -> DeltaNeutralVolConfigBuilder<SetOptionFamily<S>>
where S::OptionFamily: IsUnset,

Required.

Option instrument family (e.g. “BTC-USD”).

Source

pub fn hedge_instrument_id( self, value: InstrumentId, ) -> DeltaNeutralVolConfigBuilder<SetHedgeInstrumentId<S>>
where S::HedgeInstrumentId: IsUnset,

Required.

Hedge instrument ID (e.g. BTC-USD-SWAP.OKX).

Source

pub fn client_id( self, value: ClientId, ) -> DeltaNeutralVolConfigBuilder<SetClientId<S>>
where S::ClientId: IsUnset,

Required.

Data and execution client ID (e.g. “OKX”).

Source

pub fn target_call_delta( self, value: f64, ) -> DeltaNeutralVolConfigBuilder<SetTargetCallDelta<S>>
where S::TargetCallDelta: IsUnset,

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

Target call delta used by the startup strike heuristic.

Source

pub fn maybe_target_call_delta( self, value: Option<f64>, ) -> DeltaNeutralVolConfigBuilder<SetTargetCallDelta<S>>
where S::TargetCallDelta: IsUnset,

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

Target call delta used by the startup strike heuristic.

Source

pub fn target_put_delta( self, value: f64, ) -> DeltaNeutralVolConfigBuilder<SetTargetPutDelta<S>>
where S::TargetPutDelta: IsUnset,

Optional (Some / Option setters). Default: -0.20.

Target put delta used by the startup strike heuristic.

Source

pub fn maybe_target_put_delta( self, value: Option<f64>, ) -> DeltaNeutralVolConfigBuilder<SetTargetPutDelta<S>>
where S::TargetPutDelta: IsUnset,

Optional (Some / Option setters). Default: -0.20.

Target put delta used by the startup strike heuristic.

Source

pub fn contracts( self, value: u64, ) -> DeltaNeutralVolConfigBuilder<SetContracts<S>>
where S::Contracts: IsUnset,

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

Number of option contracts per leg.

Source

pub fn maybe_contracts( self, value: Option<u64>, ) -> DeltaNeutralVolConfigBuilder<SetContracts<S>>
where S::Contracts: IsUnset,

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

Number of option contracts per leg.

Source

pub fn rehedge_delta_threshold( self, value: f64, ) -> DeltaNeutralVolConfigBuilder<SetRehedgeDeltaThreshold<S>>
where S::RehedgeDeltaThreshold: IsUnset,

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

Portfolio delta threshold that triggers a rehedge.

Source

pub fn maybe_rehedge_delta_threshold( self, value: Option<f64>, ) -> DeltaNeutralVolConfigBuilder<SetRehedgeDeltaThreshold<S>>
where S::RehedgeDeltaThreshold: IsUnset,

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

Portfolio delta threshold that triggers a rehedge.

Source

pub fn rehedge_interval_secs( self, value: u64, ) -> DeltaNeutralVolConfigBuilder<SetRehedgeIntervalSecs<S>>
where S::RehedgeIntervalSecs: IsUnset,

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

Periodic rehedge check interval in seconds.

Source

pub fn maybe_rehedge_interval_secs( self, value: Option<u64>, ) -> DeltaNeutralVolConfigBuilder<SetRehedgeIntervalSecs<S>>
where S::RehedgeIntervalSecs: IsUnset,

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

Periodic rehedge check interval in seconds.

Source

pub fn expiry_filter( self, value: String, ) -> DeltaNeutralVolConfigBuilder<SetExpiryFilter<S>>
where S::ExpiryFilter: IsUnset,

Optional (Some / Option setters). Optional expiry date filter (e.g. “260327”).

Source

pub fn maybe_expiry_filter( self, value: Option<String>, ) -> DeltaNeutralVolConfigBuilder<SetExpiryFilter<S>>
where S::ExpiryFilter: IsUnset,

Optional (Some / Option setters). Optional expiry date filter (e.g. “260327”).

Source

pub fn enter_strangle( self, value: bool, ) -> DeltaNeutralVolConfigBuilder<SetEnterStrangle<S>>
where S::EnterStrangle: IsUnset,

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

Place strangle entry orders when Greeks are first initialized. When false the strategy only hedges externally-entered positions.

Source

pub fn maybe_enter_strangle( self, value: Option<bool>, ) -> DeltaNeutralVolConfigBuilder<SetEnterStrangle<S>>
where S::EnterStrangle: IsUnset,

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

Place strangle entry orders when Greeks are first initialized. When false the strategy only hedges externally-entered positions.

Source

pub fn entry_iv_offset( self, value: f64, ) -> DeltaNeutralVolConfigBuilder<SetEntryIvOffset<S>>
where S::EntryIvOffset: IsUnset,

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

Implied volatility offset subtracted from mark IV for entry limit price. A value of 0.02 sells 2 vol points below mark (more aggressive).

Source

pub fn maybe_entry_iv_offset( self, value: Option<f64>, ) -> DeltaNeutralVolConfigBuilder<SetEntryIvOffset<S>>
where S::EntryIvOffset: IsUnset,

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

Implied volatility offset subtracted from mark IV for entry limit price. A value of 0.02 sells 2 vol points below mark (more aggressive).

Source

pub fn entry_time_in_force( self, value: TimeInForce, ) -> DeltaNeutralVolConfigBuilder<SetEntryTimeInForce<S>>
where S::EntryTimeInForce: IsUnset,

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

Time-in-force for strangle entry orders.

Source

pub fn maybe_entry_time_in_force( self, value: Option<TimeInForce>, ) -> DeltaNeutralVolConfigBuilder<SetEntryTimeInForce<S>>
where S::EntryTimeInForce: IsUnset,

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

Time-in-force for strangle entry orders.

Source

pub fn entry_premium_offset_ticks( self, value: i32, ) -> DeltaNeutralVolConfigBuilder<SetEntryPremiumOffsetTicks<S>>
where S::EntryPremiumOffsetTicks: IsUnset,

Optional (Some / Option setters). Tick offset from the option ask used for premium-priced entry orders. When set, the strategy does not pass IV params to the adapter.

Source

pub fn maybe_entry_premium_offset_ticks( self, value: Option<i32>, ) -> DeltaNeutralVolConfigBuilder<SetEntryPremiumOffsetTicks<S>>
where S::EntryPremiumOffsetTicks: IsUnset,

Optional (Some / Option setters). Tick offset from the option ask used for premium-priced entry orders. When set, the strategy does not pass IV params to the adapter.

Source

pub fn iv_param_key( self, value: String, ) -> DeltaNeutralVolConfigBuilder<SetIvParamKey<S>>
where S::IvParamKey: IsUnset,

Optional (Some / Option setters). Default: "px_vol".to_string().

Param key for implied volatility passed to submit_order. Adapter-specific: Bybit uses "order_iv", OKX uses "px_vol".

Source

pub fn maybe_iv_param_key( self, value: Option<String>, ) -> DeltaNeutralVolConfigBuilder<SetIvParamKey<S>>
where S::IvParamKey: IsUnset,

Optional (Some / Option setters). Default: "px_vol".to_string().

Param key for implied volatility passed to submit_order. Adapter-specific: Bybit uses "order_iv", OKX uses "px_vol".

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