1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* 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};
/// StopLossDetails : StopLossDetails specifies the details of a Stop Loss Order to be created on behalf of a client. This may happen when an Order is filled that opens a Trade requiring a Stop Loss, or when a Trade's dependent Stop Loss Order is modified directly through the Trade.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct StopLossDetails {
/// The price that the Stop Loss Order will be triggered at. Only one of the price and distance fields may be specified.
#[serde(rename = "price", skip_serializing_if = "Option::is_none")]
pub price: Option<f64>,
/// Specifies the distance (in price units) from the Trade's open price to use as the Stop Loss Order price. Only one of the distance and price fields may be specified.
#[serde(rename = "distance", skip_serializing_if = "Option::is_none")]
pub distance: Option<f64>,
#[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")]
pub time_in_force: Option<models::TradeOrderTimeInForce>,
/// 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 = "gtdTime", skip_serializing_if = "Option::is_none")]
pub gtd_time: Option<String>,
#[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")]
pub client_extensions: Option<Box<models::ClientExtensions>>,
/// Flag indicating that the price for the Stop Loss Order is guaranteed. The default value depends on the GuaranteedStopLossOrderMode of the account, if it is REQUIRED, the default will be true, for DISABLED or ENABLED the default is false.
#[serde(rename = "guaranteed", skip_serializing_if = "Option::is_none")]
pub guaranteed: Option<bool>,
}
impl StopLossDetails {
/// StopLossDetails specifies the details of a Stop Loss Order to be created on behalf of a client. This may happen when an Order is filled that opens a Trade requiring a Stop Loss, or when a Trade's dependent Stop Loss Order is modified directly through the Trade.
pub fn new() -> StopLossDetails {
StopLossDetails {
price: None,
distance: None,
time_in_force: None,
gtd_time: None,
client_extensions: None,
guaranteed: None,
}
}
}