Skip to main content

off_grid_primitives/spot/
time_in_force.rs

1use serde::{Deserialize, Serialize};
2/// Time in force (TIF) specifies how long an order should remain active
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4pub enum TimeInForce {
5    /// Fill or Kill (FOK): Order must be filled completely immediately or canceled
6    /// If the order cannot be fully filled immediately, it is rejected/canceled
7    FillOrKill,
8    /// Immediate or Cancel (IOC): Order can be partially filled immediately, remaining is canceled
9    /// Any portion that cannot be filled immediately is canceled
10    ImmediateOrCancel,
11    /// Good Till Canceled (GTC): Order stays in the orderbook until filled or manually canceled
12    /// This is the default behavior for limit orders
13    GoodTillCanceled,
14}
15
16impl Default for TimeInForce {
17    fn default() -> Self {
18        TimeInForce::GoodTillCanceled
19    }
20}