mod common;
use common::{get_keypair, login, rest_client, ExampleResult};
#[tokio::main]
async fn main() -> ExampleResult {
let client = rest_client()?;
let keypair = get_keypair()?;
let _ = login(&client, &keypair, false).await?;
let auth_token = client
.auth_token()
.await
.ok_or("auth_token not set after login — SDK should have captured it")?;
client.clear_auth_token().await;
let positions = client.positions().positions_with_auth(&auth_token).await?;
println!("markets with positions: {}", positions.total_markets);
let balances = client
.positions()
.deposit_token_balances_with_auth(&auth_token)
.await?;
println!("tracked deposit balances: {}", balances.len());
let notifications = client.notifications().fetch_with_auth(&auth_token).await?;
println!("notifications: {}", notifications.len());
let status = client.referrals().get_status_with_auth(&auth_token).await?;
println!("referral codes: {}", status.referral_codes.len());
let orders = client
.orders()
.get_user_orders_with_auth(Some(50), None, &auth_token)
.await?;
println!("open orders: {}", orders.orders.len());
let fills = client
.orders()
.get_user_order_fills_with_auth(None, Some(50), None, &auth_token)
.await?;
println!("order fills: {}", fills.orders.len());
let user_metrics = client.metrics().user_with_auth(&auth_token).await?;
println!(
"user metrics: volume_usd={} outcomes_traded={}",
user_metrics.total_volume_usd, user_metrics.total_outcomes_traded
);
Ok(())
}