use quiverquant::Client; use std::env::var; #[tokio::main] async fn main() { let api_token = var("QQ_API_KEY").expect("Please set your API token at QQ_API_KEY"); let client = Client::new(api_token); let trades = client.congress_trades().await.expect("Failed to Connect!"); println!("Congressional Trades:"); for trade in trades { println!( "Rep: {}, Ticker: {}, Amount: {}, Transaction: {:?}", trade.common.representative, trade.common.ticker, trade.common.amount.unwrap_or_default(), trade.common.transaction ) } println!("Congressional Trades of TSLA:"); for trade in client.congress_trades_by_ticker("TSLA").await.expect("Failed to get TSLA trades") { println!( "Rep: {}, Amount: {}, Transaction: {:?}", trade.common.representative, trade.common.amount.unwrap_or_default(), trade.common.transaction ) } }