use xapi;
use std::error::Error;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let json = fs::read_to_string("credentials.json")?;
let credentials = xapi::Credentials::from(&json)?;
let x = xapi::connect(&credentials).await?;
let symbols = vec![
"BITCOIN", "ETHEREUM", "LITECOIN", "RIPPLE", "EURUSD", "EURPLN", "GOLD", "SILVER",
];
for symbol in symbols {
let response = x.socket.get_symbol(symbol).await?;
println!("{symbol}: {:?}", response.return_data);
x.socket.skip_delay().await;
}
Ok(())
}