ib 3.0.0

A Rust client to the Interactive Brokers HTTP REST API
Documentation
/* 
 * Client Portal Web API
 *
 * Client Poral 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 PositionData {
  /// Average cost of the position.
  #[serde(rename = "avgCost")]
  avg_cost: Option<f32>,
  /// Contract identifier from IBKR's database.
  #[serde(rename = "conid")]
  conid: Option<f32>,
  /// Number of shares or quantity of the position.
  #[serde(rename = "position")]
  position: Option<f32>
}

impl PositionData {
  pub fn new() -> PositionData {
    PositionData {
      avg_cost: None,
      conid: None,
      position: None
    }
  }

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

  pub fn with_avg_cost(mut self, avg_cost: f32) -> PositionData {
    self.avg_cost = Some(avg_cost);
    self
  }

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

  pub fn reset_avg_cost(&mut self) {
    self.avg_cost = None;
  }

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

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

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

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

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

  pub fn with_position(mut self, position: f32) -> PositionData {
    self.position = Some(position);
    self
  }

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

  pub fn reset_position(&mut self) {
    self.position = None;
  }

}