ib 1.0.0

A Rust client to the Interactive Brokers HTTP REST API
Documentation
/* 
 * Client Portal Web API
 *
 * Production version of the Client Portal Web API
 *
 * OpenAPI spec version: 1.0.0
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */


#[allow(unused_imports)]
use serde_json::Value;

#[derive(Debug, Serialize, Deserialize)]
pub struct OrderRequest {
  /// acctId is optional. It should be one of the accounts returned by /iserver/accounts. If not passed, the first one in the list is selected. 
  #[serde(rename = "acctId")]
  acct_id: Option<String>,
  /// conid is the identifier of the security you want to trade, you can find the conid with /iserver/secdef/search. 
  #[serde(rename = "conid")]
  conid: Option<i32>,
  /// conid:type for example 265598:STK
  #[serde(rename = "secType")]
  sec_type: Option<String>,
  /// cOID: Is the customer identifier. Can be some arbitrary string. e.g \"my-fb-order\". 
  #[serde(rename = "cOID")]
  c_oid: Option<String>,
  /// orderType can be one of MKT (Market), LMT (Limit), STP (Stop) or STP_LIMIT (stop limit) 
  #[serde(rename = "orderType")]
  order_type: Option<String>,
  /// listingExchange is optional. By default we use \"SMART\" routing. Possible values are available via this end point: /v1/portal/iserver/contract/{{conid}}/info, see valid_exchange: e.g: SMART,AMEX,NYSE, CBOE,ISE,CHX,ARCA,ISLAND,DRCTEDGE,BEX,BATS,EDGEA,CSFBALGO,JE FFALGO,BYX,IEX,FOXRIVER,TPLUS1,NYSENAT,PSX 
  #[serde(rename = "listingExchange")]
  listing_exchange: Option<String>,
  /// set to true if the order can be executed outside regular trading hours. 
  #[serde(rename = "outsideRTH")]
  outside_rth: Option<bool>,
  /// optional if order is MKT, for LMT, this is the limit price. For STP this is the stop price. 
  #[serde(rename = "price")]
  price: Option<f32>,
  /// SELL or BUY
  #[serde(rename = "side")]
  side: Option<String>,
  /// 
  #[serde(rename = "ticker")]
  ticker: Option<String>,
  /// GTC (Good Till Cancel) or DAY. DAY orders are automatically cancelled at the end of the Day or Trading hours. 
  #[serde(rename = "tif")]
  tif: Option<String>,
  /// for example QuickTrade
  #[serde(rename = "referrer")]
  referrer: Option<String>,
  /// usually integer, for some special cases can be float numbers
  #[serde(rename = "quantity")]
  quantity: Option<f32>
}

impl OrderRequest {
  pub fn new() -> OrderRequest {
    OrderRequest {
      acct_id: None,
      conid: None,
      sec_type: None,
      c_oid: None,
      order_type: None,
      listing_exchange: None,
      outside_rth: None,
      price: None,
      side: None,
      ticker: None,
      tif: None,
      referrer: None,
      quantity: None
    }
  }

  pub fn set_acct_id(&mut self, acct_id: String) {
    self.acct_id = Some(acct_id);
  }

  pub fn with_acct_id(mut self, acct_id: String) -> OrderRequest {
    self.acct_id = Some(acct_id);
    self
  }

  pub fn acct_id(&self) -> Option<&String> {
    self.acct_id.as_ref()
  }

  pub fn reset_acct_id(&mut self) {
    self.acct_id = None;
  }

  pub fn set_conid(&mut self, conid: i32) {
    self.conid = Some(conid);
  }

  pub fn with_conid(mut self, conid: i32) -> OrderRequest {
    self.conid = Some(conid);
    self
  }

  pub fn conid(&self) -> Option<&i32> {
    self.conid.as_ref()
  }

  pub fn reset_conid(&mut self) {
    self.conid = None;
  }

  pub fn set_sec_type(&mut self, sec_type: String) {
    self.sec_type = Some(sec_type);
  }

  pub fn with_sec_type(mut self, sec_type: String) -> OrderRequest {
    self.sec_type = Some(sec_type);
    self
  }

  pub fn sec_type(&self) -> Option<&String> {
    self.sec_type.as_ref()
  }

  pub fn reset_sec_type(&mut self) {
    self.sec_type = None;
  }

  pub fn set_c_oid(&mut self, c_oid: String) {
    self.c_oid = Some(c_oid);
  }

  pub fn with_c_oid(mut self, c_oid: String) -> OrderRequest {
    self.c_oid = Some(c_oid);
    self
  }

  pub fn c_oid(&self) -> Option<&String> {
    self.c_oid.as_ref()
  }

  pub fn reset_c_oid(&mut self) {
    self.c_oid = None;
  }

  pub fn set_order_type(&mut self, order_type: String) {
    self.order_type = Some(order_type);
  }

  pub fn with_order_type(mut self, order_type: String) -> OrderRequest {
    self.order_type = Some(order_type);
    self
  }

  pub fn order_type(&self) -> Option<&String> {
    self.order_type.as_ref()
  }

  pub fn reset_order_type(&mut self) {
    self.order_type = None;
  }

  pub fn set_listing_exchange(&mut self, listing_exchange: String) {
    self.listing_exchange = Some(listing_exchange);
  }

  pub fn with_listing_exchange(mut self, listing_exchange: String) -> OrderRequest {
    self.listing_exchange = Some(listing_exchange);
    self
  }

  pub fn listing_exchange(&self) -> Option<&String> {
    self.listing_exchange.as_ref()
  }

  pub fn reset_listing_exchange(&mut self) {
    self.listing_exchange = None;
  }

  pub fn set_outside_rth(&mut self, outside_rth: bool) {
    self.outside_rth = Some(outside_rth);
  }

  pub fn with_outside_rth(mut self, outside_rth: bool) -> OrderRequest {
    self.outside_rth = Some(outside_rth);
    self
  }

  pub fn outside_rth(&self) -> Option<&bool> {
    self.outside_rth.as_ref()
  }

  pub fn reset_outside_rth(&mut self) {
    self.outside_rth = None;
  }

  pub fn set_price(&mut self, price: f32) {
    self.price = Some(price);
  }

  pub fn with_price(mut self, price: f32) -> OrderRequest {
    self.price = Some(price);
    self
  }

  pub fn price(&self) -> Option<&f32> {
    self.price.as_ref()
  }

  pub fn reset_price(&mut self) {
    self.price = None;
  }

  pub fn set_side(&mut self, side: String) {
    self.side = Some(side);
  }

  pub fn with_side(mut self, side: String) -> OrderRequest {
    self.side = Some(side);
    self
  }

  pub fn side(&self) -> Option<&String> {
    self.side.as_ref()
  }

  pub fn reset_side(&mut self) {
    self.side = None;
  }

  pub fn set_ticker(&mut self, ticker: String) {
    self.ticker = Some(ticker);
  }

  pub fn with_ticker(mut self, ticker: String) -> OrderRequest {
    self.ticker = Some(ticker);
    self
  }

  pub fn ticker(&self) -> Option<&String> {
    self.ticker.as_ref()
  }

  pub fn reset_ticker(&mut self) {
    self.ticker = None;
  }

  pub fn set_tif(&mut self, tif: String) {
    self.tif = Some(tif);
  }

  pub fn with_tif(mut self, tif: String) -> OrderRequest {
    self.tif = Some(tif);
    self
  }

  pub fn tif(&self) -> Option<&String> {
    self.tif.as_ref()
  }

  pub fn reset_tif(&mut self) {
    self.tif = None;
  }

  pub fn set_referrer(&mut self, referrer: String) {
    self.referrer = Some(referrer);
  }

  pub fn with_referrer(mut self, referrer: String) -> OrderRequest {
    self.referrer = Some(referrer);
    self
  }

  pub fn referrer(&self) -> Option<&String> {
    self.referrer.as_ref()
  }

  pub fn reset_referrer(&mut self) {
    self.referrer = None;
  }

  pub fn set_quantity(&mut self, quantity: f32) {
    self.quantity = Some(quantity);
  }

  pub fn with_quantity(mut self, quantity: f32) -> OrderRequest {
    self.quantity = Some(quantity);
    self
  }

  pub fn quantity(&self) -> Option<&f32> {
    self.quantity.as_ref()
  }

  pub fn reset_quantity(&mut self) {
    self.quantity = None;
  }

}