From 0779d3794fa93fbb68a7df13656cf86b6d392ee8 Mon Sep 17 00:00:00 2001 From: Sik Yoon Date: Sun, 16 Jul 2023 01:39:40 +0900 Subject: [PATCH] Apply cargo formatter --- src/coex/assets_managing_team.rs | 3 ++- src/initialization.rs | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/coex/assets_managing_team.rs b/src/coex/assets_managing_team.rs index 0a27cc5..45ae1a3 100644 --- a/src/coex/assets_managing_team.rs +++ b/src/coex/assets_managing_team.rs @@ -43,7 +43,8 @@ pub async fn set_unit_usdt() { && asset_info.current_total_usdt < dec!(2000.0) { // set_unit_trade_usdt = dec!(150.0); // $150 for each trade - set_unit_trade_usdt = decimal_mul(asset_info.current_total_usdt, dec!(0.1)); // 10% of total usdt + set_unit_trade_usdt = decimal_mul(asset_info.current_total_usdt, dec!(0.1)); + // 10% of total usdt } else if dec!(2000.0) <= asset_info.current_total_usdt && asset_info.current_total_usdt < dec!(5000.0) { diff --git a/src/initialization.rs b/src/initialization.rs index d639947..1f55eb7 100644 --- a/src/initialization.rs +++ b/src/initialization.rs @@ -11,7 +11,7 @@ use reqwest::{Client, ClientBuilder}; use rust_decimal::{prelude::FromPrimitive, prelude::ToPrimitive, Decimal, RoundingStrategy}; use rust_decimal_macros::dec; use sqlx::FromRow; -use std::{io, io::Write, process::Stdio, path::Path}; +use std::{io, io::Write, path::Path, process::Stdio}; use tokio::{fs::*, io::ErrorKind, process::Command, task::JoinHandle, time::*}; const STRATEGIST_NUMBER: u32 = 16; @@ -27,37 +27,40 @@ async fn initialize_webdriver() { print!("Open webdriver..."); io::stdout().flush(); let mut output; - + let os_type = std::env::consts::OS; let mut chrome_webdriver_path = std::path::PathBuf::new(); chrome_webdriver_path.push(std::env::current_dir().unwrap()); chrome_webdriver_path.push("chromedriver"); - + match os_type { "linux" => { chrome_webdriver_path.push("chromedriver"); - }, + } "windows" => { chrome_webdriver_path.push("chromedriver.exe"); - }, + } _ => { eprintln!("\ntradingbot supports only Linux and Windows."); panic!(); } } - + if !chrome_webdriver_path.exists() { - eprintln!("\nCheck if there is chromedriver.exe ({})", chrome_webdriver_path.to_str().unwrap()); + eprintln!( + "\nCheck if there is chromedriver.exe ({})", + chrome_webdriver_path.to_str().unwrap() + ); panic!(); } - + output = Command::new(chrome_webdriver_path) .stdin(Stdio::null()) .stdout(Stdio::null()) .stderr(Stdio::null()) .spawn(); output.expect("\nOpening chromedriver failed!"); - + println!("Ok"); }