pub struct GridTradeRule {Show 22 fields
pub submitted_base_price: Option<Decimal>,
pub upper_limit_price: Option<Decimal>,
pub lower_limit_price: Option<Decimal>,
pub trigger_price_type: Option<TriggerPriceType>,
pub trigger_spread_up: Option<Decimal>,
pub trigger_spread_down: Option<Decimal>,
pub trigger_percent_up: Option<Decimal>,
pub trigger_percent_down: Option<Decimal>,
pub multiple_trigger: Option<bool>,
pub time_in_force: Option<GridTimeInForce>,
pub upper_limit_quantity: Option<Decimal>,
pub lower_limit_quantity: Option<Decimal>,
pub expire_time: Option<i64>,
pub upper_limit_event: Option<GridLimitEvent>,
pub lower_limit_event: Option<GridLimitEvent>,
pub trigger_sell_depth: Option<i32>,
pub trigger_buy_depth: Option<i32>,
pub trigger_quantity: Option<Decimal>,
pub support_shortsell: Option<bool>,
pub rth: Option<i32>,
pub grid_order_type_up: Option<String>,
pub grid_order_type_down: Option<String>,
}Expand description
Grid trading rule — parameters for submit / replace.
Mirrors the GridTradingRule message in the gridtrading proto. Prices and
quantities are decimals serialized as strings; enum-like fields are raw
integers whose code tables are documented inline.
Fields§
§submitted_base_price: Option<Decimal>Base price the grid is anchored to
upper_limit_price: Option<Decimal>Upper price bound
lower_limit_price: Option<Decimal>Lower price bound
trigger_price_type: Option<TriggerPriceType>Trigger price type (only 1 / 2 allowed)
trigger_spread_up: Option<Decimal>Upward trigger spread (absolute)
trigger_spread_down: Option<Decimal>Downward trigger spread (absolute)
trigger_percent_up: Option<Decimal>Upward trigger percent
trigger_percent_down: Option<Decimal>Downward trigger percent
multiple_trigger: Option<bool>Whether a single grid level may trigger multiple times
time_in_force: Option<GridTimeInForce>Time in force (0 = Day, 1 = GTC, 6 = GTD)
upper_limit_quantity: Option<Decimal>Quantity handled when the upper bound is reached
lower_limit_quantity: Option<Decimal>Quantity handled when the lower bound is reached
expire_time: Option<i64>Expiry time (unix seconds), used with GTD
upper_limit_event: Option<GridLimitEvent>Action when the upper bound is reached (only 1 / 2 allowed)
lower_limit_event: Option<GridLimitEvent>Action when the lower bound is reached (only 1 / 2 allowed)
trigger_sell_depth: Option<i32>Sell-side order-book depth (-5..5, 0 = use grid_order_type_up)
trigger_buy_depth: Option<i32>Buy-side order-book depth (-5..5, 0 = use grid_order_type_down)
trigger_quantity: Option<Decimal>Quantity per trigger
support_shortsell: Option<bool>Whether short selling is allowed
rth: Option<i32>Regular trading hours flag (0 / 1 / 2)
grid_order_type_up: Option<String>Sell-side order type when depth is 0 (GMO / GLO / GTG)
grid_order_type_down: Option<String>Buy-side order type when depth is 0 (GMO / GLO / GTG)
Implementations§
Source§impl GridTradeRule
impl GridTradeRule
Sourcepub fn new(
base_price: Decimal,
upper_price: Decimal,
lower_price: Decimal,
trigger: GridTrigger,
quantity: Decimal,
upper_quantity: Decimal,
lower_quantity: Decimal,
time_in_force: GridTimeInForce,
) -> Self
pub fn new( base_price: Decimal, upper_price: Decimal, lower_price: Decimal, trigger: GridTrigger, quantity: Decimal, upper_quantity: Decimal, lower_quantity: Decimal, time_in_force: GridTimeInForce, ) -> Self
Create a rule with the fields a valid grid order requires. The gateway still validates business rules, but this makes the minimum field set visible in the type signature instead of leaving all fields optional.
Sourcepub fn limit_events(self, upper: GridLimitEvent, lower: GridLimitEvent) -> Self
pub fn limit_events(self, upper: GridLimitEvent, lower: GridLimitEvent) -> Self
Set the actions taken at the upper / lower bounds.
Sourcepub fn depths(self, sell: i32, buy: i32) -> Self
pub fn depths(self, sell: i32, buy: i32) -> Self
Set the sell / buy order-book depths (0 = use the order type).
Sourcepub fn order_types(self, up: impl Into<String>, down: impl Into<String>) -> Self
pub fn order_types(self, up: impl Into<String>, down: impl Into<String>) -> Self
Set the sell / buy order types (GMO / GLO / GTG).
Sourcepub fn multiple_trigger(self, value: bool) -> Self
pub fn multiple_trigger(self, value: bool) -> Self
Allow a single grid level to trigger multiple times.
Sourcepub fn support_shortsell(self, value: bool) -> Self
pub fn support_shortsell(self, value: bool) -> Self
Allow short selling.
Sourcepub fn expire_time(self, unix_seconds: i64) -> Self
pub fn expire_time(self, unix_seconds: i64) -> Self
Set the expiry time (unix seconds), used with a GTD time-in-force.
Trait Implementations§
Source§impl Clone for GridTradeRule
impl Clone for GridTradeRule
Source§fn clone(&self) -> GridTradeRule
fn clone(&self) -> GridTradeRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GridTradeRule
impl Debug for GridTradeRule
Source§impl Default for GridTradeRule
impl Default for GridTradeRule
Source§fn default() -> GridTradeRule
fn default() -> GridTradeRule
Source§impl<'de> Deserialize<'de> for GridTradeRule
impl<'de> Deserialize<'de> for GridTradeRule
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>,
Auto Trait Implementations§
impl Freeze for GridTradeRule
impl RefUnwindSafe for GridTradeRule
impl Send for GridTradeRule
impl Sync for GridTradeRule
impl Unpin for GridTradeRule
impl UnsafeUnpin for GridTradeRule
impl UnwindSafe for GridTradeRule
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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