Struct ConditionalExpiryBuilder
pub struct ConditionalExpiryBuilder { /* private fields */ }Expand description
Builder for constructing ConditionalExpiry configurations with a fluent API.
This builder provides a type-safe way to create expiry configurations for conditional orders. When a conditional order reaches its expiry timestamp, it can either:
- Trigger immediately: go live regardless of the price condition, as the order type it was submitted with (a limit order stays a limit order)
- Cancel: Remove the order from the book
§Required Fields
The following fields must be set before calling build():
- Timestamp: Unix timestamp (milliseconds since epoch) when expiry occurs
- Trigger action: Whether to trigger or cancel on expiry
§Examples
Trigger order at expiry:
use types::api::submit_order::ConditionalExpiryBuilder;
let expiry = ConditionalExpiryBuilder::new()
.timestamp(1747313713)
.trigger_on_expiry()
.build()
.unwrap();Cancel order at expiry:
use types::api::submit_order::ConditionalExpiryBuilder;
let expiry = ConditionalExpiryBuilder::new()
.timestamp(1747313713)
.cancel_on_expiry()
.build()
.unwrap();Note: For simple cases, consider using the convenience methods
ConditionalExpiry::trigger_at() or ConditionalExpiry::cancel_at() instead.
Implementations§
§impl ConditionalExpiryBuilder
impl ConditionalExpiryBuilder
pub fn new() -> ConditionalExpiryBuilder
pub fn new() -> ConditionalExpiryBuilder
Creates a new ConditionalExpiryBuilder with all fields unset.
§Example
use types::api::submit_order::ConditionalExpiryBuilder;
let builder = ConditionalExpiryBuilder::new();pub fn timestamp(self, timestamp: u128) -> ConditionalExpiryBuilder
pub fn timestamp(self, timestamp: u128) -> ConditionalExpiryBuilder
Sets the Unix timestamp (milliseconds since epoch) when the expiry should occur.
Required field - Must be set before calling build().
§Arguments
timestamp- Unix timestamp in milliseconds (e.g., 1747313713000)
§Example
use types::api::submit_order::ConditionalExpiryBuilder;
let builder = ConditionalExpiryBuilder::new()
.timestamp(1747313713000);pub fn trigger_on_expiry(self) -> ConditionalExpiryBuilder
pub fn trigger_on_expiry(self) -> ConditionalExpiryBuilder
Configures the order to go live when expiry is reached, price condition or not.
When the timestamp is reached the conditional is armed and submitted as an
ordinary order — with the order_type and limit_price it was built
with, not converted to a market order.
Required field - Must set either this or cancel_on_expiry().
§Example
use types::api::submit_order::ConditionalExpiryBuilder;
let expiry = ConditionalExpiryBuilder::new()
.timestamp(1747313713)
.trigger_on_expiry()
.build()
.unwrap();pub fn cancel_on_expiry(self) -> ConditionalExpiryBuilder
pub fn cancel_on_expiry(self) -> ConditionalExpiryBuilder
Configures the order to cancel when expiry is reached.
When the timestamp is reached, the conditional order will be removed from the order book without executing.
Required field - Must set either this or trigger_on_expiry().
§Example
use types::api::submit_order::ConditionalExpiryBuilder;
let expiry = ConditionalExpiryBuilder::new()
.timestamp(1747313713)
.cancel_on_expiry()
.build()
.unwrap();pub fn trigger(self, trigger: bool) -> ConditionalExpiryBuilder
pub fn trigger(self, trigger: bool) -> ConditionalExpiryBuilder
Sets the trigger flag directly.
Tip: Consider using trigger_on_expiry() or
cancel_on_expiry() for better readability.
§Arguments
trigger-trueto trigger on expiry,falseto cancel
pub fn build(self) -> Result<ConditionalExpiry, ConditionalExpiryBuilderError>
pub fn build(self) -> Result<ConditionalExpiry, ConditionalExpiryBuilderError>
Builds the ConditionalExpiry, consuming the builder.
§Returns
Ok(ConditionalExpiry)- Successfully built expiry configurationErr(ConditionalExpiryBuilderError)- Missing required fields
§Errors
Returns an error if either timestamp or trigger field is not set.
§Example
use types::api::submit_order::ConditionalExpiryBuilder;
let expiry = ConditionalExpiryBuilder::new()
.timestamp(1747313713)
.trigger_on_expiry()
.build()
.expect("Failed to build expiry");Trait Implementations§
§impl Debug for ConditionalExpiryBuilder
impl Debug for ConditionalExpiryBuilder
§impl Default for ConditionalExpiryBuilder
impl Default for ConditionalExpiryBuilder
§fn default() -> ConditionalExpiryBuilder
fn default() -> ConditionalExpiryBuilder
Auto Trait Implementations§
impl Freeze for ConditionalExpiryBuilder
impl RefUnwindSafe for ConditionalExpiryBuilder
impl Send for ConditionalExpiryBuilder
impl Sync for ConditionalExpiryBuilder
impl Unpin for ConditionalExpiryBuilder
impl UnsafeUnpin for ConditionalExpiryBuilder
impl UnwindSafe for ConditionalExpiryBuilder
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
U: Sized,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
U: Sized,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> InitializableFromZeroed for Twhere
T: Default,
impl<T> InitializableFromZeroed for Twhere
T: Default,
§unsafe fn initialize(place: *mut T)
unsafe fn initialize(place: *mut T)
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].impl<T> MaybeSend for Twhere
T: Send,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.