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};

/// TradeReduce : A TradeReduce object represents a Trade for an instrument that was reduced (either partially or fully) in an Account. It is found embedded in Transactions that affect the position of an instrument in the account, specifically the OrderFill Transaction.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TradeReduce {
    /// The ID of the Trade that was reduced or closed
    #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")]
    pub trade_id: Option<i32>,
    /// The number of units that the Trade was reduced by
    #[serde(rename = "units", skip_serializing_if = "Option::is_none")]
    pub units: Option<f64>,
    /// The average price that the units were closed at. This price may be clamped for guaranteed Stop Loss Orders.
    #[serde(rename = "price", skip_serializing_if = "Option::is_none")]
    pub price: Option<f64>,
    /// The PL realized when reducing the Trade
    #[serde(rename = "realizedPL", skip_serializing_if = "Option::is_none")]
    pub realized_pl: Option<f64>,
    /// The financing paid/collected when reducing the Trade
    #[serde(rename = "financing", skip_serializing_if = "Option::is_none")]
    pub financing: Option<f64>,
    /// This is the fee that is charged for closing the Trade if it has a guaranteed Stop Loss Order attached to it.
    #[serde(rename = "guaranteedExecutionFee", skip_serializing_if = "Option::is_none")]
    pub guaranteed_execution_fee: Option<f64>,
    /// The half spread cost for the trade reduce/close. This can be apositive or negative value and is represented in the home currency of the Account.
    #[serde(rename = "halfSpreadCost", skip_serializing_if = "Option::is_none")]
    pub half_spread_cost: Option<f64>,
}

impl TradeReduce {
    /// A TradeReduce object represents a Trade for an instrument that was reduced (either partially or fully) in an Account. It is found embedded in Transactions that affect the position of an instrument in the account, specifically the OrderFill Transaction.
    pub fn new() -> TradeReduce {
        TradeReduce {
            trade_id: None,
            units: None,
            price: None,
            realized_pl: None,
            financing: None,
            guaranteed_execution_fee: None,
            half_spread_cost: None,
        }
    }
}