From 98a29873b978d868bd137347827cc270ae6f4835 Mon Sep 17 00:00:00 2001 From: Sik Yoon Date: Thu, 6 Jun 2024 06:20:32 +0900 Subject: [PATCH] Update filtering --- src/strategy_team/future_strategy_long.rs | 13 ++++++++----- src/strategy_team/future_strategy_short.rs | 12 +++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/strategy_team/future_strategy_long.rs b/src/strategy_team/future_strategy_long.rs index 2934a9c..965aca1 100644 --- a/src/strategy_team/future_strategy_long.rs +++ b/src/strategy_team/future_strategy_long.rs @@ -44,6 +44,7 @@ pub async fn list_up_for_buy( && lr_vec[lr_vec.len()-1].lr_value > lr_vec[lr_vec.len()-2].lr_value && lr_vec.last().unwrap().r_squared <= 0.01 { + values.closetime = current_info.1; do_buy = true; } } @@ -386,11 +387,13 @@ pub async fn list_up_for_sell(all_data: &AllData, futures_exchange_info_map: &Ha if let Some(lr_vec) = lr_map.get(&element.symbol) { if !element.current_price.is_zero() && lr_vec.len() > 10 && lr_vec.last().is_some_and(|x| x.close_time > server_epoch) { - if element.pure_profit_percent >= element.target_percent { - is_sell = true; - } else if element.pure_profit_percent <= element.stoploss_percent { - is_sell = true; - } else if lr_vec.last().unwrap().r_squared >= 0.55 { + // if element.pure_profit_percent >= element.target_percent { + // is_sell = true; + // } else if element.pure_profit_percent <= element.stoploss_percent { + // is_sell = true; + // } else + + if lr_vec.last().unwrap().r_squared >= 0.55 { is_sell = true; } diff --git a/src/strategy_team/future_strategy_short.rs b/src/strategy_team/future_strategy_short.rs index 803dd91..e836081 100644 --- a/src/strategy_team/future_strategy_short.rs +++ b/src/strategy_team/future_strategy_short.rs @@ -44,6 +44,7 @@ pub async fn list_up_for_buy( && lr_vec[lr_vec.len()-1].lr_value < lr_vec[lr_vec.len()-2].lr_value && lr_vec.last().unwrap().r_squared <= 0.01 { + values.closetime = current_info.1; do_buy = true; } } @@ -391,11 +392,12 @@ pub async fn list_up_for_sell(all_data: &AllData, futures_exchange_info_map: &Ha if let Some(lr_vec) = lr_map.get(&element.symbol) { if !element.current_price.is_zero() && lr_vec.len() > 10 && lr_vec.last().is_some_and(|x| x.close_time > server_epoch) { - if element.pure_profit_percent >= element.target_percent { - is_sell = true; - } else if element.pure_profit_percent <= element.stoploss_percent { - is_sell = true; - } else if lr_vec.last().unwrap().r_squared >= 0.55 { + // if element.pure_profit_percent >= element.target_percent { + // is_sell = true; + // } else if element.pure_profit_percent <= element.stoploss_percent { + // is_sell = true; + // } else + if lr_vec.last().unwrap().r_squared >= 0.55 { is_sell = true; }