mirror of
				https://github.com/comit-network/xmr-btc-swap.git
				synced 2025-11-03 15:35:44 -05:00 
			
		
		
		
	Add kraken_ticker CLI for local testing of the client
This commit is contained in:
		
							parent
							
								
									60d6d50246
								
							
						
					
					
						commit
						7575d412b8
					
				
					 1 changed files with 21 additions and 0 deletions
				
			
		
							
								
								
									
										21
									
								
								swap/src/bin/kraken_ticker.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								swap/src/bin/kraken_ticker.rs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
use anyhow::{Context, Result};
 | 
			
		||||
 | 
			
		||||
#[tokio::main]
 | 
			
		||||
async fn main() -> Result<()> {
 | 
			
		||||
    tracing::subscriber::set_global_default(
 | 
			
		||||
        tracing_subscriber::fmt().with_env_filter("trace").finish(),
 | 
			
		||||
    )?;
 | 
			
		||||
 | 
			
		||||
    let mut ticker = swap::kraken::connect()
 | 
			
		||||
        .await
 | 
			
		||||
        .context("Failed to connect to kraken")?;
 | 
			
		||||
 | 
			
		||||
    loop {
 | 
			
		||||
        ticker.changed().await?;
 | 
			
		||||
 | 
			
		||||
        match &*ticker.borrow() {
 | 
			
		||||
            Ok(rate) => println!("Rate update: {}", rate),
 | 
			
		||||
            Err(e) => println!("Error: {:#}", e),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue