diff --git a/src/coex/order_team.rs b/src/coex/order_team.rs index 07089af..c546ae6 100644 --- a/src/coex/order_team.rs +++ b/src/coex/order_team.rs @@ -624,11 +624,11 @@ async fn update_repeat_task( // quote_commission_precision, // RoundingStrategy::ToZero, // ); - let pure_profit_percent = ((expected_get_usdt.to_f64().unwrap() + let mut pure_profit_percent = ((expected_get_usdt.to_f64().unwrap() / element.used_usdt.to_f64().unwrap()) - 1.0) * 100.0; - + pure_profit_percent = (pure_profit_percent * 100.0).round() / 100.0; // Rounding update_record_build.push(element.id.to_string()); // id update_record_build.push(price.to_string()); // current_price update_record_build.push(expected_get_usdt.to_string()); //expected_get_usdt @@ -735,7 +735,7 @@ pub async fn limit_order_sell( dec!(1), ), dec!(100), - ); + ).round_dp(2); insert_value_container.push(pure_profit_percent.to_string()); // pure_profit_percent insert_value_container.push(buy_ordered_coin.maximum_profit_percent.to_string()); // maximum_profit_percent insert_value_container.push(buy_ordered_coin.registerer.to_string()); // registerer @@ -863,7 +863,7 @@ pub async fn limit_order_sell( dec!(1), ), dec!(100), - ); + ).round_dp(2); insert_value_container .push(buy_ordered_coin.pure_profit_percent.to_string()); // pure_profit_percent @@ -1371,7 +1371,7 @@ pub async fn cancel_sell_order( dec!(1), ), dec!(100), - ); + ).round_dp(2); let table_name = String::from("sell_ordered_coin_list"); let mut value_build = String::from("\'"); @@ -1422,7 +1422,7 @@ pub async fn cancel_sell_order( dec!(1), ), dec!(100), - ); + ).round_dp(2); let table_name = String::from("sell_ordered_coin_list"); let mut value_build = String::from("\'"); @@ -1781,7 +1781,7 @@ pub async fn query_sell_order( let pure_profit_percent = decimal_mul( decimal_sub(decimal_div(get_usdt_fee_adjusted, order.used_usdt), dec!(1)), dec!(100), - ); + ).round_dp(2); let table_name = String::from("sell_ordered_coin_list"); let mut value_build = String::from("\'");