update filtering

This commit is contained in:
Sik Yoon 2024-06-01 21:08:15 +09:00
parent 33221f253a
commit 2b08bbfd66
2 changed files with 4 additions and 4 deletions

View File

@ -118,8 +118,8 @@ pub async fn list_up_for_buy(
if let Some(truncated_vec) = realtime_price_vec.get(realtime_price_vec.len()-element_number..) {
let min_price = truncated_vec
.iter()
.min_by(|x, y| x.opclo_price.partial_cmp(&y.opclo_price).unwrap())
.unwrap().opclo_price;
.min_by(|x, y| x.low_price.partial_cmp(&y.low_price).unwrap())
.unwrap().low_price;
if values.current_price.to_f64().is_some_and(|a| a < min_price) {
let mut stoploss_percent = ((values.current_price.to_f64().unwrap() - min_price) * 100.0) / values.current_price.to_f64().unwrap();
stoploss_percent = (stoploss_percent * 100.0).floor() / 100.0;

View File

@ -118,8 +118,8 @@ pub async fn list_up_for_buy(
if let Some(truncated_vec) = realtime_price_vec.get(realtime_price_vec.len()-element_number..) {
let max_price = truncated_vec
.iter()
.max_by(|x, y| x.opclo_price.partial_cmp(&y.opclo_price).unwrap())
.unwrap().opclo_price;
.max_by(|x, y| x.high_price.partial_cmp(&y.high_price).unwrap())
.unwrap().high_price;
if values.current_price.to_f64().is_some_and(|a| a < max_price) {
let mut stoploss_percent = ((values.current_price.to_f64().unwrap() - max_price) * 100.0) / values.current_price.to_f64().unwrap();
stoploss_percent = (stoploss_percent * 100.0).floor() / 100.0;