pub enum TimeInForce {
GTC,
IOC,
FOK,
PostOnly,
}Expand description
Specifies the time-in-force policy for an order, controlling how long it remains active.
Time-in-force (TIF) dictates the duration an order stays open before it is executed or canceled. In perpetual futures trading, TIF is critical for managing order execution in volatile markets. For example:
- GTC (Good Till Canceled): Remains active until filled or manually canceled, suitable for patient strategies.
- IOC (Immediate or Cancel): Executes immediately, with any unfilled portion canceled, ideal for high-frequency trading.
- FOK (Fill or Kill): Must be fully filled immediately or canceled, used for large orders needing guaranteed execution.
- PostOnly: Ensures the order adds liquidity (maker order) and cancels if it would take liquidity, useful for fee optimization.
Bots must carefully select TIF based on strategy. For instance, a PostOnly order can reduce fees but may fail in fast-moving markets, impacting profitability.
Variants§
GTC
Good Till Canceled: Order remains active until filled or canceled.
IOC
Immediate or Cancel: Executes immediately, with unfilled portion canceled.
FOK
Fill or Kill: Must be fully filled immediately or canceled.
PostOnly
Post Only: Ensures the order is a maker order, cancels if it would be a taker.
Implementations§
Trait Implementations§
Source§impl Clone for TimeInForce
impl Clone for TimeInForce
Source§fn clone(&self) -> TimeInForce
fn clone(&self) -> TimeInForce
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TimeInForce
impl Debug for TimeInForce
Source§impl Default for TimeInForce
impl Default for TimeInForce
Source§fn default() -> TimeInForce
fn default() -> TimeInForce
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TimeInForce
impl<'de> Deserialize<'de> for TimeInForce
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TimeInForce
impl RefUnwindSafe for TimeInForce
impl Send for TimeInForce
impl Sync for TimeInForce
impl Unpin for TimeInForce
impl UnwindSafe for TimeInForce
Blanket Implementations§
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
Mutably borrows from an owned value. Read more