Struct fxoanda::account::list_transactions::ListTransactionsRequest
source · 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
impl ListTransactionsRequest
sourcepub fn new() -> ListTransactionsRequest
pub fn new() -> ListTransactionsRequest
Examples found in repository?
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),
}
}
pub fn with_uri(self, x: String) -> Self
sourcepub fn with_account_id(self, x: String) -> Self
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?
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),
}
}
The authorization bearer token previously obtained by the client format: The string ’Bearer ’ followed by the token.
- param String
- return ListTransactionsRequest
sourcepub fn with_accept_datetime_format(self, x: String) -> Self
pub fn with_accept_datetime_format(self, x: String) -> Self
Format of DateTime fields in the request and response.
- param String
- return ListTransactionsRequest
sourcepub fn with_from(self, x: DateTime<Utc>) -> Self
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
sourcepub fn with_to(self, x: DateTime<Utc>) -> Self
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
sourcepub fn with_page_size(self, x: i32) -> Self
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
sourcepub fn with_otype(self, x: Vec<String>) -> Self
pub fn with_otype(self, x: Vec<String>) -> Self
A filter for restricting the types of Transactions to retreive.
- param Vec
- return ListTransactionsRequest
sourcepub async fn remote(
self,
client: &Client
) -> Result<ListTransactionsResponse, Box<dyn Error>>
pub async fn remote( self, client: &Client ) -> Result<ListTransactionsResponse, Box<dyn Error>>
Examples found in repository?
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),
}
}