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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* 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};
/// OrderFillTransaction : An OrderFillTransaction represents the filling of an Order in the client's Account.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OrderFillTransaction {
/// The ID of the Order filled.
#[serde(rename = "orderID", skip_serializing_if = "Option::is_none")]
pub order_id: Option<i32>,
/// The client Order ID of the Order filled (only provided if the client has assigned one).
#[serde(rename = "clientOrderID", skip_serializing_if = "Option::is_none")]
pub client_order_id: Option<String>,
#[serde(rename = "instrument", skip_serializing_if = "Option::is_none")]
pub instrument: Option<models::InstrumentName>,
/// The number of units filled by the OrderFill.
#[serde(rename = "units", skip_serializing_if = "Option::is_none")]
pub units: Option<f64>,
/// This is the conversion factor in effect for the Account at the time of the OrderFill for converting any gains realized in Instrument quote units into units of the Account's home currency.
#[serde(rename = "gainQuoteHomeConversionFactor", skip_serializing_if = "Option::is_none")]
pub gain_quote_home_conversion_factor: Option<f64>,
/// This is the conversion factor in effect for the Account at the time of the OrderFill for converting any losses realized in Instrument quote units into units of the Account's home currency.
#[serde(rename = "lossQuoteHomeConversionFactor", skip_serializing_if = "Option::is_none")]
pub loss_quote_home_conversion_factor: Option<f64>,
/// This field is now deprecated and should no longer be used. The individual tradesClosed, tradeReduced and tradeOpened fields contain the exact/official price each unit was filled at.
#[serde(rename = "price", skip_serializing_if = "Option::is_none")]
pub price: Option<f64>,
/// The price that all of the units of the OrderFill should have been filled at, in the absence of guaranteed price execution. This factors in the Account's current ClientPrice, used liquidity and the units of the OrderFill only. If no Trades were closed with their price clamped for guaranteed stop loss enforcement, then this value will match the price fields of each Trade opened, closed, and reduced, and they will all be the exact same.
#[serde(rename = "fullVWAP", skip_serializing_if = "Option::is_none")]
pub full_vwap: Option<f64>,
#[serde(rename = "fullPrice", skip_serializing_if = "Option::is_none")]
pub full_price: Option<Box<models::ClientPrice>>,
#[serde(rename = "reason", skip_serializing_if = "Option::is_none")]
pub reason: Option<models::OrderFillReason>,
/// The profit or loss incurred when the Order was filled.
#[serde(rename = "pl", skip_serializing_if = "Option::is_none")]
pub pl: Option<f64>,
/// The financing paid or collected when the Order was filled
#[serde(rename = "financing", skip_serializing_if = "Option::is_none")]
pub financing: Option<f64>,
/// The commission charged in the Account's home currency as a result of filling the Order. The commission is always represented as a positive quantity of the Account's home currency, however it reduces the balance in the Account.
#[serde(rename = "commission", skip_serializing_if = "Option::is_none")]
pub commission: Option<f64>,
/// The total guaranteed execution fees charged for all Trades opened, closed or reduced with guaranteed Stop Loss Orders.
#[serde(rename = "guaranteedExecutionFee", skip_serializing_if = "Option::is_none")]
pub guaranteed_execution_fee: Option<f64>,
/// The Account's balance after the Order was filled.
#[serde(rename = "accountBalance", skip_serializing_if = "Option::is_none")]
pub account_balance: Option<f64>,
#[serde(rename = "tradeOpened", skip_serializing_if = "Option::is_none")]
pub trade_opened: Option<Box<models::TradeOpen>>,
/// The Trades that were closed when the Order was filled (only provided if filling the Order resulted in a closing open Trades).
#[serde(rename = "tradesClosed", skip_serializing_if = "Option::is_none")]
pub trades_closed: Option<Vec<models::TradeReduce>>,
#[serde(rename = "tradeReduced", skip_serializing_if = "Option::is_none")]
pub trade_reduced: Option<Box<models::TradeReduce>>,
/// The half spread cost for the OrderFill, which is the sum of the halfSpreadCost values in the tradeOpened, tradesClosed and tradeReduced fields. This can be a positive 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 OrderFillTransaction {
/// An OrderFillTransaction represents the filling of an Order in the client's Account.
pub fn new() -> OrderFillTransaction {
OrderFillTransaction {
order_id: None,
client_order_id: None,
instrument: None,
units: None,
gain_quote_home_conversion_factor: None,
loss_quote_home_conversion_factor: None,
price: None,
full_vwap: None,
full_price: None,
reason: None,
pl: None,
financing: None,
commission: None,
guaranteed_execution_fee: None,
account_balance: None,
trade_opened: None,
trades_closed: None,
trade_reduced: None,
half_spread_cost: None,
}
}
}