Struct tdameritrade_rust::OrderBuilder
source · pub struct OrderBuilder { /* private fields */ }
Expand description
Builder to streamline creation of TD Ameritrade orders
Parameters
- session: The market session when order should be executed. Valid sessions are
NORMAL
,AM
,PM
, orSEAMLESS
- duration: Length of time order will be active. Valid durations are
DAY
,GOOD_TILL_CANCEL
, orFILL_OR_KILL
- order_type: Type of order. Valid order types are
MARKET
,LIMIT
,STOP
,STOP_LIMIT
,TRAILING_STOP
,MARKET_ON_CLOSE
,EXERCISE
,TRAILING_STOP_LIMIT
,NET_DEBIT
,NET_CREDIT
, orNET_ZERO
- complex_order_strategy_type: Strategy type for complex orders. Valid complex strategy types are
NONE
,COVERED
,VERTICAL
,BACK_RATIO
,CALENDAR
,DIAGONAL
,STRADDLE
,STRANGLE
,COLLAR_SYNTHETIC
,BUTTERFLY
,CONDOR
,IRON_CONDOR
,VERTICAL_ROLL
,COLLAR_WITH_STOCK
,DOUBLE_DIAGONAL
,UNBALANCED_BUTTERFLY
,UNBALANCED_CONDOR
,UNBALANCED_IRON_CONDOR
,UNBALANCED_VERTICAL_ROLL
, orCUSTOM
- quantity: Number of shares for the order. Accepts
f64
- requested_destination: Preferred order destination. Valid destinations are
INET
,ECN_ARCA
,CBOE
,AMEX
,PHLX
,ISE
,BOX
,NYSE
,NASDAQ
,BATS
,C2
, orAUTO
- stop_price: The stop price. Accepts
f64
- stop_price_link_basis: The stop price link basis. Valid stop price link baseis are
MANUAL
,BASE
,TRIGGER
,LAST
,BID
,ASK
,ASK_BID
,MARK
, orAVERAGE
- stop_price_link_type: The stop price link type. Valid stop price link types are
VALUE
,PERCENT
, orTICK
- stop_price_offset: The stop price offset. Accepts
f64
- stop_type: The stop type. Valid stop types are
STANDARD
,BID
,ASK
,LAST
, orMARK
- price_link_basis: The price link basis. Valid price link baseis are
MANUAL
,BASE
,TRIGGER
,LAST
,BID
,ASK
,ASK_BID
,MARK
, orAVERAGE
- price_link_type: The price link type. Valid price link types are
VALUE
,PERCENT
, orTICK
- price: Order price. Accepts
f64
- order_leg_collection: Order Leg Collections
- activation_price: The activation price. Accepts
f64
- special_instruction: Special instruction for order. Valid instructions are
ALL_OR_NONE
,DO_NOT_REDUCE
, orALL_OR_NONE_DO_NOT_REDUCE
- order_strategy_type: Strategy type for composite orders. Valid strategy types are
SINGLE
,OCO
, orTRIGGER
- child_order_strategies: Order strategies for composite orders. Accepts
OrderBuilder
Implementations§
source§impl OrderBuilder
impl OrderBuilder
pub fn new() -> OrderBuilder
pub fn set_session(self, session: &str) -> OrderBuilder
pub fn clear_session(self) -> OrderBuilder
pub fn set_duration(self, duration: &str) -> OrderBuilder
pub fn clear_duration(self) -> OrderBuilder
pub fn set_order_type(self, order_type: &str) -> OrderBuilder
pub fn clear_order_type(self) -> OrderBuilder
pub fn set_complex_order_strategy_type( self, complex_order_strategy_type: &str ) -> OrderBuilder
pub fn clear_complex_order_strategy_type(self) -> OrderBuilder
pub fn set_quantity(self, quantity: f64) -> OrderBuilder
pub fn clear_quantity(self) -> OrderBuilder
pub fn set_requested_destination( self, requested_destination: &str ) -> OrderBuilder
pub fn clear_requested_destination(self) -> OrderBuilder
pub fn set_stop_price(self, stop_price: f64) -> OrderBuilder
pub fn clear_stop_price(self) -> OrderBuilder
pub fn set_stop_price_link_basis( self, stop_price_link_basis: &str ) -> OrderBuilder
pub fn clear_stop_price_link_basis(self) -> OrderBuilder
pub fn set_stop_price_link_type( self, stop_price_link_type: &str ) -> OrderBuilder
pub fn clear_stop_price_link_type(self) -> OrderBuilder
pub fn set_stop_price_offset(self, stop_price_offset: f64) -> OrderBuilder
pub fn clear_stop_price_offset(self) -> OrderBuilder
pub fn set_stop_type(self, stop_type: &str) -> OrderBuilder
pub fn clear_stop_type(self) -> OrderBuilder
pub fn set_price_link_basis(self, price_link_basis: &str) -> OrderBuilder
pub fn clear_price_link_basis(self) -> OrderBuilder
pub fn set_price_link_type(self, price_link_type: &str) -> OrderBuilder
pub fn clear_price_link_type(self) -> OrderBuilder
pub fn set_price(self, price: f64) -> OrderBuilder
pub fn clear_price(self) -> OrderBuilder
pub fn set_activation_price(self, activation_price: f64) -> OrderBuilder
pub fn clear_activation_price(self) -> OrderBuilder
pub fn set_special_instruction(self, special_instruction: &str) -> OrderBuilder
pub fn clear_special_instruction(self) -> OrderBuilder
pub fn set_order_strategy_type(self, order_strategy_type: &str) -> OrderBuilder
pub fn clear_order_strategy_type(self) -> OrderBuilder
pub fn add_child_order_strategy( self, child_order_strategy: OrderBuilder ) -> OrderBuilder
pub fn clear_child_order_strategies(self) -> OrderBuilder
sourcepub fn add_order_leg(
self,
instruction: &str,
instrument_asset_type: &str,
instrument_symbol: &str,
quantity: f64
) -> OrderBuilder
pub fn add_order_leg( self, instruction: &str, instrument_asset_type: &str, instrument_symbol: &str, quantity: f64 ) -> OrderBuilder
Add Order Leg
Parameters
- instruction: Type of trade. Valid instructions are
BUY
,SELL
,BUY_TO_COVER
,SELL_SHORT
,BUY_TO_OPEN
,BUY_TO_CLOSE
,SELL_TO_OPEN
,SELL_TO_CLOSE
orEXCHANGE
- instrument_asset_type: Type of asset traded. Valid asset types are
EQUITY
,OPTION
,INDEX
,MUTUAL_FUND
,CASH_EQUIVALENT
,FIXED_INCOME
, orCURRENCY
- instrument_symbol: Symbol traded. Accepts
&str
- quantity: Amount of shares traded. Accepts
f64
pub fn clear_order_legs(self) -> OrderBuilder
pub fn build(self) -> Result<String, TDAClientError>
Trait Implementations§
source§impl Debug for OrderBuilder
impl Debug for OrderBuilder
Auto Trait Implementations§
impl RefUnwindSafe for OrderBuilder
impl Send for OrderBuilder
impl Sync for OrderBuilder
impl Unpin for OrderBuilder
impl UnwindSafe for OrderBuilder
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