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, or SEAMLESS
  • duration: Length of time order will be active. Valid durations are DAY, GOOD_TILL_CANCEL, or FILL_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, or NET_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, or CUSTOM
  • 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, or AUTO
  • 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, or AVERAGE
  • stop_price_link_type: The stop price link type. Valid stop price link types are VALUE, PERCENT, or TICK
  • stop_price_offset: The stop price offset. Accepts f64
  • stop_type: The stop type. Valid stop types are STANDARD, BID, ASK, LAST, or MARK
  • price_link_basis: The price link basis. Valid price link baseis are MANUAL, BASE, TRIGGER, LAST, BID, ASK, ASK_BID, MARK, or AVERAGE
  • price_link_type: The price link type. Valid price link types are VALUE, PERCENT, or TICK
  • 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, or ALL_OR_NONE_DO_NOT_REDUCE
  • order_strategy_type: Strategy type for composite orders. Valid strategy types are SINGLE, OCO, or TRIGGER
  • child_order_strategies: Order strategies for composite orders. Accepts OrderBuilder

Implementations§

source§

impl OrderBuilder

source

pub fn new() -> OrderBuilder

source

pub fn set_session(self, session: &str) -> OrderBuilder

source

pub fn clear_session(self) -> OrderBuilder

source

pub fn set_duration(self, duration: &str) -> OrderBuilder

source

pub fn clear_duration(self) -> OrderBuilder

source

pub fn set_order_type(self, order_type: &str) -> OrderBuilder

source

pub fn clear_order_type(self) -> OrderBuilder

source

pub fn set_complex_order_strategy_type( self, complex_order_strategy_type: &str ) -> OrderBuilder

source

pub fn clear_complex_order_strategy_type(self) -> OrderBuilder

source

pub fn set_quantity(self, quantity: f64) -> OrderBuilder

source

pub fn clear_quantity(self) -> OrderBuilder

source

pub fn set_requested_destination( self, requested_destination: &str ) -> OrderBuilder

source

pub fn clear_requested_destination(self) -> OrderBuilder

source

pub fn set_stop_price(self, stop_price: f64) -> OrderBuilder

source

pub fn clear_stop_price(self) -> OrderBuilder

source

pub fn set_stop_price_offset(self, stop_price_offset: f64) -> OrderBuilder

source

pub fn clear_stop_price_offset(self) -> OrderBuilder

source

pub fn set_stop_type(self, stop_type: &str) -> OrderBuilder

source

pub fn clear_stop_type(self) -> OrderBuilder

source

pub fn set_price(self, price: f64) -> OrderBuilder

source

pub fn clear_price(self) -> OrderBuilder

source

pub fn set_activation_price(self, activation_price: f64) -> OrderBuilder

source

pub fn clear_activation_price(self) -> OrderBuilder

source

pub fn set_special_instruction(self, special_instruction: &str) -> OrderBuilder

source

pub fn clear_special_instruction(self) -> OrderBuilder

source

pub fn set_order_strategy_type(self, order_strategy_type: &str) -> OrderBuilder

source

pub fn clear_order_strategy_type(self) -> OrderBuilder

source

pub fn add_child_order_strategy( self, child_order_strategy: OrderBuilder ) -> OrderBuilder

source

pub fn clear_child_order_strategies(self) -> OrderBuilder

source

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 or EXCHANGE
  • instrument_asset_type: Type of asset traded. Valid asset types are EQUITY, OPTION, INDEX, MUTUAL_FUND, CASH_EQUIVALENT, FIXED_INCOME, or CURRENCY
  • instrument_symbol: Symbol traded. Accepts &str
  • quantity: Amount of shares traded. Accepts f64
source

pub fn clear_order_legs(self) -> OrderBuilder

source

pub fn build(self) -> Result<String, TDAClientError>

Trait Implementations§

source§

impl Debug for OrderBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Serialize for OrderBuilder

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more