Wraps the etrade API and implements the required oauth1 flow.
The default feature for the crate includes a thread safe in-memory store for the oauth tokens.
There is an optional feature secretservice
which will the keychain on linux to store the token information.
```rust use anyhow::{anyhow, Result}; use etrade::orders::{ListOrdersRequest, OrderStatus, TransactionType}; use etrade::KeychainStore; use etrade::{self, SortOrder}; use etrade::{accounts, MarketSession, SecurityType}; use accounts::BalanceRequest;
async fn main() -> Result<()> { let mode: etrade::Mode = etrade::Mode::Live; let session = Arc::new(etrade::Session::new(mode, KeychainStore)); let accounts = etrade::accounts::Api::new(session.clone());
let msg1 = "Consumer key:\n"; io::stderr().writeall(msg1.asbytes()).await?;
let mut consumertoken = String::new(); io::BufReader::new(io::stdin()).readline(&mut consumer_token).await?;
let msg2 = "Consumer secret:\n"; io::stderr().writeall(msg2.asbytes()).await?;
let mut consumersecret = String::new(); io::BufReader::new(io::stdin()).readline(&mut consumer_secret).await?;
session .initialize(consumertoken.trim().tostring(), consumersecret.trim().tostring()) .await?; println!("updated the {} consumer token and key", mode);
let account_list = accounts.list(etrade::OOB).await?;
for account in &accountlist { let balance = accounts .balance( &account.accountidkey, BalanceRequest { realtimenav: if realtime { Some(real_time) } else { None }, ..Default::default() }, oob, ) .await?; println!("{:?}", balance); }
Ok(()) } ```