2021-03-04 21:39:42 -05:00
|
|
|
use anyhow::{Context, Result};
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<()> {
|
|
|
|
tracing::subscriber::set_global_default(
|
2021-03-08 23:35:22 -05:00
|
|
|
tracing_subscriber::fmt().with_env_filter("debug").finish(),
|
2021-03-04 21:39:42 -05:00
|
|
|
)?;
|
|
|
|
|
2021-03-08 23:35:22 -05:00
|
|
|
let mut ticker = swap::kraken::connect().context("Failed to connect to kraken")?;
|
2021-03-04 21:39:42 -05:00
|
|
|
|
|
|
|
loop {
|
2021-03-31 21:09:51 -04:00
|
|
|
match ticker.wait_for_next_update().await? {
|
|
|
|
Ok(update) => println!("Price update: {}", update.ask),
|
2021-03-04 21:39:42 -05:00
|
|
|
Err(e) => println!("Error: {:#}", e),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|