pub struct OrderRequestLeg {
pub instruction: OrderInstruction,
pub quantity: Decimal,
pub instrument: OrderRequestInstrument,
pub position_effect: Option<PositionEffect>,
pub quantity_type: Option<QuantityType>,
pub div_cap_gains: Option<DivCapGains>,
pub to_symbol: Option<String>,
}Fields§
§instruction: OrderInstruction§quantity: DecimalShares or contracts; whole numbers for equities and options. For a
mutual fund, denominated as quantity_type says. Sent as a JSON number.
instrument: OrderRequestInstrument§position_effect: Option<PositionEffect>§quantity_type: Option<QuantityType>Mutual funds only: whether quantity is shares, dollars or the whole
position.
div_cap_gains: Option<DivCapGains>Mutual funds only: what happens to dividends and capital gains.
to_symbol: Option<String>Mutual funds only: the fund an EXCHANGE moves into.
Implementations§
Source§impl OrderRequestLeg
impl OrderRequestLeg
pub fn new( instruction: OrderInstruction, instrument: OrderRequestInstrument, quantity: impl Into<Decimal>, ) -> Self
pub fn equity( instruction: OrderInstruction, symbol: impl Into<String>, quantity: impl Into<Decimal>, ) -> Self
Sourcepub fn option(
instruction: OrderInstruction,
symbol: impl Into<String>,
quantity: impl Into<Decimal>,
) -> Self
pub fn option( instruction: OrderInstruction, symbol: impl Into<String>, quantity: impl Into<Decimal>, ) -> Self
quantity is in contracts.
pub fn with_position_effect(self, effect: PositionEffect) -> Self
Source§impl OrderRequestLeg
impl OrderRequestLeg
Sourcepub fn validate(&self) -> Result<(), ValidationError>
pub fn validate(&self) -> Result<(), ValidationError>
The leg-level rules OrderRequest::validate applies to each leg.
Legs may be equities (and ETFs, which positions report as
COLLECTIVE_INVESTMENT), options or mutual funds; other asset types
are refused rather than sent unchecked.
Trait Implementations§
Source§impl Clone for OrderRequestLeg
impl Clone for OrderRequestLeg
Source§impl Debug for OrderRequestLeg
impl Debug for OrderRequestLeg
Source§impl<'de> Deserialize<'de> for OrderRequestLeg
impl<'de> Deserialize<'de> for OrderRequestLeg
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
Source§impl JsonSchema for OrderRequestLeg
impl JsonSchema for OrderRequestLeg
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for OrderRequestLeg
impl PartialEq for OrderRequestLeg
Source§impl Serialize for OrderRequestLeg
impl Serialize for OrderRequestLeg
impl StructuralPartialEq for OrderRequestLeg
Auto Trait Implementations§
impl Freeze for OrderRequestLeg
impl RefUnwindSafe for OrderRequestLeg
impl Send for OrderRequestLeg
impl Sync for OrderRequestLeg
impl Unpin for OrderRequestLeg
impl UnsafeUnpin for OrderRequestLeg
impl UnwindSafe for OrderRequestLeg
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