oanda-v20-openapi 0.2.1

The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
Documentation
/*
 * OANDA v20 API
 *
 * The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
 *
 * The version of the OpenAPI document: 0.2.1
 * Contact: jmicoud02@gmail.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// MarketOrderTransaction : A MarketOrderTransaction represents the creation of a Market Order in the user's account. A Market Order is an Order that is filled immediately at the current market price.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MarketOrderTransaction {
    /// The Transaction's Identifier.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<i32>,
    /// A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
    #[serde(rename = "time", skip_serializing_if = "Option::is_none")]
    pub time: Option<String>,
    /// The ID of the user that initiated the creation of the Transaction.
    #[serde(rename = "userID", skip_serializing_if = "Option::is_none")]
    pub user_id: Option<i32>,
    /// The Account's identifier
    #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    /// The ID of the \"batch\" that the Transaction belongs to. Transactions in the same batch are applied to the Account simultaneously.
    #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")]
    pub batch_id: Option<i32>,
    /// The Request ID of the request which generated the transaction.
    #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")]
    pub request_id: Option<String>,
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<models::TransactionType>,
    #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")]
    pub instrument: Option<models::InstrumentName>,
    /// The quantity requested to be filled by the Market Order. A posititive number of units results in a long Order, and a negative number of units results in a short Order.
    #[serde(rename = "units", skip_serializing_if = "Option::is_none")]
    pub units: Option<f64>,
    #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")]
    pub time_in_force: Option<models::MarketOrderTradeClose>,
    /// The worst price that the client is willing to have the Market Order filled at.
    #[serde(rename = "priceBound", skip_serializing_if = "Option::is_none")]
    pub price_bound: Option<f64>,
    #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")]
    pub position_fill: Option<models::MarketOrderPositionFill>,
    #[serde(rename = "tradeClose", skip_serializing_if = "Option::is_none")]
    pub trade_close: Option<Box<models::MarketOrderTradeClose>>,
    #[serde(rename = "longPositionCloseout", skip_serializing_if = "Option::is_none")]
    pub long_position_closeout: Option<Box<models::MarketOrderPositionCloseout>>,
    #[serde(rename = "shortPositionCloseout", skip_serializing_if = "Option::is_none")]
    pub short_position_closeout: Option<Box<models::MarketOrderPositionCloseout>>,
    #[serde(rename = "marginCloseout", skip_serializing_if = "Option::is_none")]
    pub margin_closeout: Option<Box<models::MarketOrderMarginCloseout>>,
    #[serde(rename = "delayedTradeClose", skip_serializing_if = "Option::is_none")]
    pub delayed_trade_close: Option<Box<models::MarketOrderDelayedTradeClose>>,
    #[serde(rename = "reason", skip_serializing_if = "Option::is_none")]
    pub reason: Option<models::MarketOrderReason>,
    #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")]
    pub client_extensions: Option<Box<models::ClientExtensions>>,
    #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")]
    pub take_profit_on_fill: Option<Box<models::TakeProfitDetails>>,
    #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")]
    pub stop_loss_on_fill: Option<Box<models::StopLossDetails>>,
    #[serde(rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none")]
    pub trailing_stop_loss_on_fill: Option<Box<models::TrailingStopLossDetails>>,
    #[serde(rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none")]
    pub trade_client_extensions: Option<Box<models::ClientExtensions>>,
}

impl MarketOrderTransaction {
    /// A MarketOrderTransaction represents the creation of a Market Order in the user's account. A Market Order is an Order that is filled immediately at the current market price.
    pub fn new() -> MarketOrderTransaction {
        MarketOrderTransaction {
            id: None,
            time: None,
            user_id: None,
            account_id: None,
            batch_id: None,
            request_id: None,
            r#type: None,
            instrument: None,
            units: None,
            time_in_force: None,
            price_bound: None,
            position_fill: None,
            trade_close: None,
            long_position_closeout: None,
            short_position_closeout: None,
            margin_closeout: None,
            delayed_trade_close: None,
            reason: None,
            client_extensions: None,
            take_profit_on_fill: None,
            stop_loss_on_fill: None,
            trailing_stop_loss_on_fill: None,
            trade_client_extensions: None,
        }
    }
}