Round percentage
This commit is contained in:
parent
7ac4f6a544
commit
eb44e21768
|
|
@ -624,11 +624,11 @@ async fn update_repeat_task(
|
||||||
// quote_commission_precision,
|
// quote_commission_precision,
|
||||||
// RoundingStrategy::ToZero,
|
// 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())
|
/ element.used_usdt.to_f64().unwrap())
|
||||||
- 1.0)
|
- 1.0)
|
||||||
* 100.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(element.id.to_string()); // id
|
||||||
update_record_build.push(price.to_string()); // current_price
|
update_record_build.push(price.to_string()); // current_price
|
||||||
update_record_build.push(expected_get_usdt.to_string()); //expected_get_usdt
|
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!(1),
|
||||||
),
|
),
|
||||||
dec!(100),
|
dec!(100),
|
||||||
);
|
).round_dp(2);
|
||||||
insert_value_container.push(pure_profit_percent.to_string()); // pure_profit_percent
|
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.maximum_profit_percent.to_string()); // maximum_profit_percent
|
||||||
insert_value_container.push(buy_ordered_coin.registerer.to_string()); // registerer
|
insert_value_container.push(buy_ordered_coin.registerer.to_string()); // registerer
|
||||||
|
|
@ -863,7 +863,7 @@ pub async fn limit_order_sell(
|
||||||
dec!(1),
|
dec!(1),
|
||||||
),
|
),
|
||||||
dec!(100),
|
dec!(100),
|
||||||
);
|
).round_dp(2);
|
||||||
insert_value_container
|
insert_value_container
|
||||||
.push(buy_ordered_coin.pure_profit_percent.to_string());
|
.push(buy_ordered_coin.pure_profit_percent.to_string());
|
||||||
// pure_profit_percent
|
// pure_profit_percent
|
||||||
|
|
@ -1371,7 +1371,7 @@ pub async fn cancel_sell_order(
|
||||||
dec!(1),
|
dec!(1),
|
||||||
),
|
),
|
||||||
dec!(100),
|
dec!(100),
|
||||||
);
|
).round_dp(2);
|
||||||
|
|
||||||
let table_name = String::from("sell_ordered_coin_list");
|
let table_name = String::from("sell_ordered_coin_list");
|
||||||
let mut value_build = String::from("\'");
|
let mut value_build = String::from("\'");
|
||||||
|
|
@ -1422,7 +1422,7 @@ pub async fn cancel_sell_order(
|
||||||
dec!(1),
|
dec!(1),
|
||||||
),
|
),
|
||||||
dec!(100),
|
dec!(100),
|
||||||
);
|
).round_dp(2);
|
||||||
|
|
||||||
let table_name = String::from("sell_ordered_coin_list");
|
let table_name = String::from("sell_ordered_coin_list");
|
||||||
let mut value_build = String::from("\'");
|
let mut value_build = String::from("\'");
|
||||||
|
|
@ -1781,7 +1781,7 @@ pub async fn query_sell_order(
|
||||||
let pure_profit_percent = decimal_mul(
|
let pure_profit_percent = decimal_mul(
|
||||||
decimal_sub(decimal_div(get_usdt_fee_adjusted, order.used_usdt), dec!(1)),
|
decimal_sub(decimal_div(get_usdt_fee_adjusted, order.used_usdt), dec!(1)),
|
||||||
dec!(100),
|
dec!(100),
|
||||||
);
|
).round_dp(2);
|
||||||
|
|
||||||
let table_name = String::from("sell_ordered_coin_list");
|
let table_name = String::from("sell_ordered_coin_list");
|
||||||
let mut value_build = String::from("\'");
|
let mut value_build = String::from("\'");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user