oanda-client 1.1.0

An async, provider-native Rust client for OANDA's v20 REST API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Read-only account snapshot; run with `OANDA_TOKEN` and `OANDA_ACCOUNT_ID` set.
use oanda_client::{AccountID, Client, Environment};

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let token = std::env::var("OANDA_TOKEN")?;
    let account = AccountID::new(std::env::var("OANDA_ACCOUNT_ID")?)?;
    let client = Client::builder(Environment::Practice, token).build()?;
    let summary = client.account_summary(&account).await?;
    println!("request ID: {:?}", summary.request_id);
    println!("last transaction: {:?}", summary.last_transaction_id);
    Ok(())
}