From 9540191955d4c7cf2a4cf7086ec121b942eee99c Mon Sep 17 00:00:00 2001 From: Sik Yoon Date: Sat, 1 Jun 2024 17:57:32 +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 31eaca9..71742f8 100644 --- a/src/strategy_team/future_strategy_long.rs +++ b/src/strategy_team/future_strategy_long.rs @@ -127,10 +127,10 @@ pub async fn list_up_for_buy( let mut stoploss_percent = ((min_price - values.current_price.to_f64().unwrap()) * 100.0) / values.current_price.to_f64().unwrap(); stoploss_percent = (stoploss_percent * 100.0).floor() / 100.0; values.stoploss = rust_decimal::prelude::FromPrimitive::from_f64(stoploss_percent).unwrap(); - let mut target_percent = stoploss_percent.abs() * 1.5; + let mut target_percent = stoploss_percent.abs() * 1.25; target_percent = (target_percent * 100.0).floor() / 100.0; values.target_price = rust_decimal::prelude::FromPrimitive::from_f64(target_percent).unwrap(); - if stoploss_percent < - 0.07 && stoploss_percent > -1.5 { + if stoploss_percent < - 0.07 && stoploss_percent > -1.0 { do_buy = true; } } diff --git a/src/strategy_team/future_strategy_short.rs b/src/strategy_team/future_strategy_short.rs index 3746a50..5bd2647 100644 --- a/src/strategy_team/future_strategy_short.rs +++ b/src/strategy_team/future_strategy_short.rs @@ -127,10 +127,10 @@ pub async fn list_up_for_buy( 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; values.stoploss = rust_decimal::prelude::FromPrimitive::from_f64(stoploss_percent).unwrap(); - let mut target_percent = stoploss_percent.abs() * 1.5; + let mut target_percent = stoploss_percent.abs() * 1.25; target_percent = (target_percent * 100.0).floor() / 100.0; values.target_price = rust_decimal::prelude::FromPrimitive::from_f64(target_percent).unwrap(); - if stoploss_percent < - 0.07 && stoploss_percent > -1.5 { + if stoploss_percent < - 0.07 && stoploss_percent > -1.0 { do_buy = true; } }