pub struct Bracket { /* private fields */ }Expand description
ProjectX bracket-leg configuration.
Placement accepts bracket legs only in the account’s Auto OCO Brackets
mode. Position Brackets mode rejects them with provider code 2, even
though the response can include an ID for the rejected order record.
The tick offset is signed: the provider applies its sign against the
entry side and the protective leg. A long stop loss requires a negative
count — the provider rejects the positive form with code 2, “Ticks
should be less than zero when longing” — and the provider reference does
not enumerate the sign for every side and leg. This crate therefore
neither infers nor rewrites the sign: the caller chooses it, and the
nonzero value is preserved exactly through accessors and serialization.
Implementations§
Source§impl Bracket
impl Bracket
Sourcepub fn new(
ticks: i32,
order_type: OrderType,
) -> Result<Self, RequestValidationError>
pub fn new( ticks: i32, order_type: OrderType, ) -> Result<Self, RequestValidationError>
Creates a bracket leg with a nonzero signed distance in ticks.
§Errors
Returns an error when ticks is zero, or when order_type
is not documented by the provider for bracket requests.
Sourcepub const fn order_type(&self) -> OrderType
pub const fn order_type(&self) -> OrderType
Returns the bracket order type.