/*
 * Client Portal Web API
 *
 * Client Portal Web API
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */




#[derive(Clone, Debug, PartialEq, 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", skip_serializing_if = "Option::is_none")]
    pub 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", skip_serializing_if = "Option::is_none")]
    pub conid: Option<i32>,
    /// conid:type for example 265598:STK
    #[serde(rename = "secType", skip_serializing_if = "Option::is_none")]
    pub sec_type: Option<String>,
    /// Customer Order ID. An arbitraty string that can be used to identify the order, e.g \"my-fb-order\". The value must be unique for a 24h span. Please do not set this value for child orders when placing a bracket order. 
    #[serde(rename = "cOID", skip_serializing_if = "Option::is_none")]
    pub c_oid: Option<String>,
    /// When placing bracket orders, the child parentId must be equal to the cOId (customer order id) of the parent. 
    #[serde(rename = "parentId", skip_serializing_if = "Option::is_none")]
    pub parent_id: Option<String>,
    /// orderType can be one of MKT (Market), LMT (Limit), STP (Stop) or STP_LIMIT (stop limit) 
    #[serde(rename = "orderType", skip_serializing_if = "Option::is_none")]
    pub 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", skip_serializing_if = "Option::is_none")]
    pub listing_exchange: Option<String>,
    /// set to true if the order can be executed outside regular trading hours. 
    #[serde(rename = "outsideRTH", skip_serializing_if = "Option::is_none")]
    pub 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", skip_serializing_if = "Option::is_none")]
    pub price: Option<f32>,
    /// SELL or BUY
    #[serde(rename = "side", skip_serializing_if = "Option::is_none")]
    pub side: Option<String>,
    /// 
    #[serde(rename = "ticker", skip_serializing_if = "Option::is_none")]
    pub 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", skip_serializing_if = "Option::is_none")]
    pub tif: Option<String>,
    /// for example QuickTrade
    #[serde(rename = "referrer", skip_serializing_if = "Option::is_none")]
    pub referrer: Option<String>,
    /// usually integer, for some special cases can be float numbers
    #[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
    pub quantity: Option<f32>,
    /// double number, this is the cash quantity field which can only be used for FX conversion order. 
    #[serde(rename = "fxQty", skip_serializing_if = "Option::is_none")]
    pub fx_qty: Option<f32>,
    /// If true, the system will use the Adaptive Algo to submit the order https://www.interactivebrokers.com/en/index.php?f=19091 
    #[serde(rename = "useAdaptive", skip_serializing_if = "Option::is_none")]
    pub use_adaptive: Option<bool>,
    /// set to true if the order is a FX conversion order 
    #[serde(rename = "isCurrencyConversion", skip_serializing_if = "Option::is_none")]
    pub is_currency_conversion: Option<bool>,
    /// Set the allocation method when placing an order using an FA account for a group Possible allocation methods are \"NetLiquidity\", \"AvailableEquity\", \"EqualQuantity\" and \"PctChange\". 
    #[serde(rename = "allocationMethod", skip_serializing_if = "Option::is_none")]
    pub allocation_method: Option<String>,
}

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


