oanda_v20_openapi/models/position_side.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/// PositionSide : The representation of a Position for a single direction (long or short).
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct PositionSide {
17 /// Number of units in the position (negative value indicates short position, positive indicates long position).
18 #[serde(rename = "units", skip_serializing_if = "Option::is_none")]
19 pub units: Option<f64>,
20 /// Volume-weighted average of the underlying Trade open prices for the Position.
21 #[serde(rename = "averagePrice", skip_serializing_if = "Option::is_none")]
22 pub average_price: Option<f64>,
23 /// List of the open Trade IDs which contribute to the open Position.
24 #[serde(rename = "tradeIDs", skip_serializing_if = "Option::is_none")]
25 pub trade_ids: Option<Vec<i32>>,
26 /// Profit/loss realized by the PositionSide over the lifetime of the Account.
27 #[serde(rename = "pl", skip_serializing_if = "Option::is_none")]
28 pub pl: Option<f64>,
29 /// The unrealized profit/loss of all open Trades that contribute to this PositionSide.
30 #[serde(rename = "unrealizedPL", skip_serializing_if = "Option::is_none")]
31 pub unrealized_pl: Option<f64>,
32 /// Profit/loss realized by the PositionSide since the Account's resettablePL was last reset by the client.
33 #[serde(rename = "resettablePL", skip_serializing_if = "Option::is_none")]
34 pub resettable_pl: Option<f64>,
35 /// The total amount of financing paid/collected for this PositionSide over the lifetime of the Account.
36 #[serde(rename = "financing", skip_serializing_if = "Option::is_none")]
37 pub financing: Option<f64>,
38 /// The total amount of fees charged over the lifetime of the Account for the execution of guaranteed Stop Loss Orders attached to Trades for this PositionSide.
39 #[serde(rename = "guaranteedExecutionFees", skip_serializing_if = "Option::is_none")]
40 pub guaranteed_execution_fees: Option<f64>,
41}
42
43impl PositionSide {
44 /// The representation of a Position for a single direction (long or short).
45 pub fn new() -> PositionSide {
46 PositionSide {
47 units: None,
48 average_price: None,
49 trade_ids: None,
50 pl: None,
51 unrealized_pl: None,
52 resettable_pl: None,
53 financing: None,
54 guaranteed_execution_fees: None,
55 }
56 }
57}
58