use pc_core::{Exchange, FetchMarketsParams};
use pc_exchange_predictfun::{PredictFun, PredictFunConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Use testnet if no API key
let config = match std::env::var("PREDICTFUN_API_KEY") {
Ok(key) => PredictFunConfig::new().with_api_key(&key),
Err(_) => PredictFunConfig::testnet(),
};
let exchange = PredictFun::new(config)?;
let markets = exchange
.fetch_markets(Some(FetchMarketsParams {
limit: Some(10),
active_only: true,
}))
.await?;
for market in markets {
println!("─────────────────────────────────");
println!("ID: {}", market.id);
println!("Question: {}", market.question);
println!("Volume: ${:.0}", market.volume);
}
Ok(())
}