From 2b08bbfd6684ce32e033fcc4f047ef298e048d11 Mon Sep 17 00:00:00 2001 From: Sik Yoon Date: Sat, 1 Jun 2024 21:08:15 +0900 Subject: [PATCH] update filtering --- src/strategy_team/future_strategy_long.rs | 4 ++-- src/strategy_team/future_strategy_short.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/strategy_team/future_strategy_long.rs b/src/strategy_team/future_strategy_long.rs index 9193ebb..8e7ab6d 100644 --- a/src/strategy_team/future_strategy_long.rs +++ b/src/strategy_team/future_strategy_long.rs @@ -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; diff --git a/src/strategy_team/future_strategy_short.rs b/src/strategy_team/future_strategy_short.rs index 7923c94..816bdbe 100644 --- a/src/strategy_team/future_strategy_short.rs +++ b/src/strategy_team/future_strategy_short.rs @@ -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;