pub struct ListPendingOrdersRequest { /* private fields */ }
Expand description
Pending Orders List all pending Orders in an Account
Implementations§
source§impl ListPendingOrdersRequest
impl ListPendingOrdersRequest
sourcepub fn new() -> ListPendingOrdersRequest
pub fn new() -> ListPendingOrdersRequest
Examples found in repository?
examples/endpoints.rs (lines 106-107)
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 ListPendingOrdersRequest
Examples found in repository?
examples/endpoints.rs (line 108)
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 ListPendingOrdersRequest
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 ListPendingOrdersRequest
sourcepub async fn remote(
self,
client: &Client
) -> Result<ListPendingOrdersResponse, Box<dyn Error>>
pub async fn remote( self, client: &Client ) -> Result<ListPendingOrdersResponse, Box<dyn Error>>
Examples found in repository?
examples/endpoints.rs (line 109)
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 ListPendingOrdersRequest
impl Debug for ListPendingOrdersRequest
source§impl<'de> Deserialize<'de> for ListPendingOrdersRequest
impl<'de> Deserialize<'de> for ListPendingOrdersRequest
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ListPendingOrdersRequest
impl RefUnwindSafe for ListPendingOrdersRequest
impl Send for ListPendingOrdersRequest
impl Sync for ListPendingOrdersRequest
impl Unpin for ListPendingOrdersRequest
impl UnwindSafe for ListPendingOrdersRequest
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more