Skip to main content

oanda_v20_openapi/models/
instrument.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/// Instrument : Full specification of an Instrument.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Instrument {
17    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
18    pub name: Option<models::InstrumentName>,
19    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
20    pub r#type: Option<models::InstrumentType>,
21    /// The display name of the Instrument
22    #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")]
23    pub display_name: Option<String>,
24    /// The location of the \"pip\" for this instrument. The decimal position of the pip in this Instrument's price can be found at 10 ^ pipLocation (e.g. -4 pipLocation results in a decimal pip position of 10 ^ -4 = 0.0001).
25    #[serde(rename = "pipLocation", skip_serializing_if = "Option::is_none")]
26    pub pip_location: Option<i32>,
27    /// The number of decimal places that should be used to display prices for this instrument. (e.g. a displayPrecision of 5 would result in a price of \"1\" being displayed as \"1.00000\")
28    #[serde(rename = "displayPrecision", skip_serializing_if = "Option::is_none")]
29    pub display_precision: Option<i32>,
30    /// The amount of decimal places that may be provided when specifying the number of units traded for this instrument.
31    #[serde(rename = "tradeUnitsPrecision", skip_serializing_if = "Option::is_none")]
32    pub trade_units_precision: Option<i32>,
33    /// The smallest number of units allowed to be traded for this instrument.
34    #[serde(rename = "minimumTradeSize", skip_serializing_if = "Option::is_none")]
35    pub minimum_trade_size: Option<String>,
36    /// The maximum trailing stop distance allowed for a trailing stop loss created for this instrument. Specified in price units.
37    #[serde(rename = "maximumTrailingStopDistance", skip_serializing_if = "Option::is_none")]
38    pub maximum_trailing_stop_distance: Option<String>,
39    /// The minimum trailing stop distance allowed for a trailing stop loss created for this instrument. Specified in price units.
40    #[serde(rename = "minimumTrailingStopDistance", skip_serializing_if = "Option::is_none")]
41    pub minimum_trailing_stop_distance: Option<String>,
42    /// The maximum position size allowed for this instrument. Specified in units.
43    #[serde(rename = "maximumPositionSize", skip_serializing_if = "Option::is_none")]
44    pub maximum_position_size: Option<String>,
45    /// The maximum units allowed for an Order placed for this instrument. Specified in units.
46    #[serde(rename = "maximumOrderUnits", skip_serializing_if = "Option::is_none")]
47    pub maximum_order_units: Option<String>,
48    /// The margin rate for this instrument.
49    #[serde(rename = "marginRate", skip_serializing_if = "Option::is_none")]
50    pub margin_rate: Option<String>,
51    #[serde(rename = "commission", skip_serializing_if = "Option::is_none")]
52    pub commission: Option<Box<models::InstrumentComission>>,
53}
54
55impl Instrument {
56    /// Full specification of an Instrument.
57    pub fn new() -> Instrument {
58        Instrument {
59            name: None,
60            r#type: None,
61            display_name: None,
62            pip_location: None,
63            display_precision: None,
64            trade_units_precision: None,
65            minimum_trade_size: None,
66            maximum_trailing_stop_distance: None,
67            minimum_trailing_stop_distance: None,
68            maximum_position_size: None,
69            maximum_order_units: None,
70            margin_rate: None,
71            commission: None,
72        }
73    }
74}
75