pub struct ListTransactionsRequest { /* private fields */ }
Expand description

List Transactions Get a list of Transactions pages that satisfy a time-based Transaction query.

Implementations§

source§

impl ListTransactionsRequest

source

pub fn new() -> ListTransactionsRequest

Examples found in repository?
examples/endpoints.rs (lines 156-157)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
async fn main() {
    let api_key = env::var("OANDA_KEY").expect("expected OANDA_KEY environment variable to be set");
    let api_host = env
        ::var("OANDA_HOST")
        .expect("expected OANDA_HOST environment variable to be set");

    // only run example program against demo account!!
    assert_eq!(api_host, "api-fxpractice.oanda.com");

    let client = fxoanda::Client {
        host: String::from(api_host),
        reqwest: reqwest::Client::new(),
        authentication: String::from(api_key),
    };

    match
        fxoanda::GetInstrumentCandlesRequest
            ::new()
            .with_instrument("EUR_USD".to_string())
            .with_granularity(CandlestickGranularity::H4)
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => eprintln!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetPositionBookRequest
            ::new()
            .with_instrument("EUR_USD".to_string())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetOrderBookRequest
            ::new()
            .with_instrument("EUR_USD".to_string())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match fxoanda::ListAccountsRequest::new().remote(&client).await {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    let response = fxoanda::ListAccountsRequest::new().remote(&client).await.unwrap();
    let accounts = response.accounts.expect("Did not find 'accounts' field in response");
    let account = accounts.get(0).expect("Did not find an 'account' in the 'accounts' field");
    let account_id = account.id
        .as_ref()
        .expect("Did not find an 'id' field in the 'account'")
        .to_string();

    match
        fxoanda::GetAccountSummaryRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetAccountRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetAccountInstrumentsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListOrdersRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListPendingOrdersRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListTradesRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListOpenTradesRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListPositionsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListOpenPositionsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListTransactionsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }
}
source

pub fn with_uri(self, x: String) -> Self

source

pub fn with_account_id(self, x: String) -> Self

Account Identifier format: “-”-delimited string with format “{siteID}-{divisionID}-{userID}-{accountNumber}”

  • param String
  • return ListTransactionsRequest
Examples found in repository?
examples/endpoints.rs (line 158)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
async fn main() {
    let api_key = env::var("OANDA_KEY").expect("expected OANDA_KEY environment variable to be set");
    let api_host = env
        ::var("OANDA_HOST")
        .expect("expected OANDA_HOST environment variable to be set");

    // only run example program against demo account!!
    assert_eq!(api_host, "api-fxpractice.oanda.com");

    let client = fxoanda::Client {
        host: String::from(api_host),
        reqwest: reqwest::Client::new(),
        authentication: String::from(api_key),
    };

    match
        fxoanda::GetInstrumentCandlesRequest
            ::new()
            .with_instrument("EUR_USD".to_string())
            .with_granularity(CandlestickGranularity::H4)
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => eprintln!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetPositionBookRequest
            ::new()
            .with_instrument("EUR_USD".to_string())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetOrderBookRequest
            ::new()
            .with_instrument("EUR_USD".to_string())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match fxoanda::ListAccountsRequest::new().remote(&client).await {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    let response = fxoanda::ListAccountsRequest::new().remote(&client).await.unwrap();
    let accounts = response.accounts.expect("Did not find 'accounts' field in response");
    let account = accounts.get(0).expect("Did not find an 'account' in the 'accounts' field");
    let account_id = account.id
        .as_ref()
        .expect("Did not find an 'id' field in the 'account'")
        .to_string();

    match
        fxoanda::GetAccountSummaryRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetAccountRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetAccountInstrumentsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListOrdersRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListPendingOrdersRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListTradesRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListOpenTradesRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListPositionsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListOpenPositionsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListTransactionsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }
}
source

pub fn with_authorization(self, x: String) -> Self

The authorization bearer token previously obtained by the client format: The string ’Bearer ’ followed by the token.

  • param String
  • return ListTransactionsRequest
source

pub fn with_accept_datetime_format(self, x: String) -> Self

Format of DateTime fields in the request and response.

  • param String
  • return ListTransactionsRequest
source

pub fn with_from(self, x: DateTime<Utc>) -> Self

The starting time (inclusive) of the time range for the Transactions being queried. format: 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).

  • param DateTime
  • return ListTransactionsRequest
source

pub fn with_to(self, x: DateTime<Utc>) -> Self

The ending time (inclusive) of the time range for the Transactions being queried. format: 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).

  • param DateTime
  • return ListTransactionsRequest
source

pub fn with_page_size(self, x: i32) -> Self

The number of Transactions to include in each page of the results.

  • param i32
  • return ListTransactionsRequest
source

pub fn with_otype(self, x: Vec<String>) -> Self

A filter for restricting the types of Transactions to retreive.

  • param Vec
  • return ListTransactionsRequest
source

pub async fn remote( self, client: &Client ) -> Result<ListTransactionsResponse, Box<dyn Error>>

Examples found in repository?
examples/endpoints.rs (line 159)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
async fn main() {
    let api_key = env::var("OANDA_KEY").expect("expected OANDA_KEY environment variable to be set");
    let api_host = env
        ::var("OANDA_HOST")
        .expect("expected OANDA_HOST environment variable to be set");

    // only run example program against demo account!!
    assert_eq!(api_host, "api-fxpractice.oanda.com");

    let client = fxoanda::Client {
        host: String::from(api_host),
        reqwest: reqwest::Client::new(),
        authentication: String::from(api_key),
    };

    match
        fxoanda::GetInstrumentCandlesRequest
            ::new()
            .with_instrument("EUR_USD".to_string())
            .with_granularity(CandlestickGranularity::H4)
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => eprintln!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetPositionBookRequest
            ::new()
            .with_instrument("EUR_USD".to_string())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetOrderBookRequest
            ::new()
            .with_instrument("EUR_USD".to_string())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match fxoanda::ListAccountsRequest::new().remote(&client).await {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    let response = fxoanda::ListAccountsRequest::new().remote(&client).await.unwrap();
    let accounts = response.accounts.expect("Did not find 'accounts' field in response");
    let account = accounts.get(0).expect("Did not find an 'account' in the 'accounts' field");
    let account_id = account.id
        .as_ref()
        .expect("Did not find an 'id' field in the 'account'")
        .to_string();

    match
        fxoanda::GetAccountSummaryRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetAccountRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::GetAccountInstrumentsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListOrdersRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListPendingOrdersRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListTradesRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListOpenTradesRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListPositionsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListOpenPositionsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }

    match
        fxoanda::ListTransactionsRequest
            ::new()
            .with_account_id(account_id.to_owned())
            .remote(&client).await
    {
        Ok(x) => println!("OK: {:#?}", x),
        Err(e) => println!("ERR: {:#?}", e),
    }
}

Trait Implementations§

source§

impl Debug for ListTransactionsRequest

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for ListTransactionsRequest

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for ListTransactionsRequest

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,