oanda_v20_openapi/models/trade_open.rs
1/*
2 * OANDA v20 API
3 *
4 * The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
5 *
6 * The version of the OpenAPI document: 0.2.1
7 * Contact: jmicoud02@gmail.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// TradeOpen : A TradeOpen object represents a Trade for an instrument that was opened in an Account. It is found embedded in Transactions that affect the position of an instrument in the Account, specifically the OrderFill Transaction.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TradeOpen {
17 /// The ID of the Trade that was opened
18 #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")]
19 pub trade_id: Option<i32>,
20 /// The number of units opened by the Trade
21 #[serde(rename = "units", skip_serializing_if = "Option::is_none")]
22 pub units: Option<f64>,
23 /// The average price that the units were opened at.
24 #[serde(rename = "price", skip_serializing_if = "Option::is_none")]
25 pub price: Option<f64>,
26 /// This is the fee charged for opening the trade if it has a guaranteed Stop Loss Order attached to it.
27 #[serde(rename = "guaranteedExecutionFee", skip_serializing_if = "Option::is_none")]
28 pub guaranteed_execution_fee: Option<f64>,
29 #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")]
30 pub client_extensions: Option<Box<models::ClientExtensions>>,
31 /// The half spread cost for the trade open. This can be a positive or negative value and is represented in the home currency of the Account.
32 #[serde(rename = "halfSpreadCost", skip_serializing_if = "Option::is_none")]
33 pub half_spread_cost: Option<f64>,
34 /// The margin required at the time the Trade was created. Note, this is the 'pure' margin required, it is not the 'effective' margin used that factors in the trade risk if a GSLO is attached to the trade.
35 #[serde(rename = "initialMarginRequired", skip_serializing_if = "Option::is_none")]
36 pub initial_margin_required: Option<f64>,
37}
38
39impl TradeOpen {
40 /// A TradeOpen object represents a Trade for an instrument that was opened in an Account. It is found embedded in Transactions that affect the position of an instrument in the Account, specifically the OrderFill Transaction.
41 pub fn new() -> TradeOpen {
42 TradeOpen {
43 trade_id: None,
44 units: None,
45 price: None,
46 guaranteed_execution_fee: None,
47 client_extensions: None,
48 half_spread_cost: None,
49 initial_margin_required: None,
50 }
51 }
52}
53