Update filtering

This commit is contained in:
Sik Yoon 2024-06-06 14:14:09 +09:00
parent 98a29873b9
commit 805d8c87e8
2 changed files with 12 additions and 6 deletions

View File

@ -42,6 +42,7 @@ pub async fn list_up_for_buy(
if lr_vec.len() > 10
&& lr_vec.last().is_some_and(|x| x.close_time > server_epoch)
&& lr_vec[lr_vec.len()-1].lr_value > lr_vec[lr_vec.len()-2].lr_value
&& lr_vec[lr_vec.len()-2].lr_value > lr_vec[lr_vec.len()-3].lr_value
&& lr_vec.last().unwrap().r_squared <= 0.01
{
values.closetime = current_info.1;
@ -161,7 +162,7 @@ pub async fn list_up_for_buy(
// }
// remove_keys(&mut filtered_data, keys_to_remove).await;
// Wiliams -50 > %R(100)
// Wiliams -60 > %R(100)
let mut keys_to_remove: HashSet<String> = HashSet::new();
let mut wpr100_map = wiliams_percent_r(100, &alldata.rt_price_1m_vec, &filtered_data).await?;
let server_epoch = get_server_epoch().await;
@ -170,7 +171,7 @@ pub async fn list_up_for_buy(
if let Some(wpr100_vec) = wpr100_map.get(symbol) {
if wpr100_vec.len() > 15
&& wpr100_vec.last().unwrap().close_time > server_epoch
&& wpr100_vec.last().unwrap().r_value < -50.0 {
&& wpr100_vec.last().unwrap().r_value < -60.0 {
do_buy = true;
}
}
@ -393,7 +394,9 @@ pub async fn list_up_for_sell(all_data: &AllData, futures_exchange_info_map: &Ha
// is_sell = true;
// } else
if lr_vec.last().unwrap().r_squared >= 0.55 {
if element.pure_profit_percent.is_sign_positive() && lr_vec.last().unwrap().r_squared >= 0.7 {
is_sell = true;
} else if lr_vec[lr_vec.len()-1].lr_value < lr_vec[lr_vec.len()-2].lr_value {
is_sell = true;
}

View File

@ -42,6 +42,7 @@ pub async fn list_up_for_buy(
if lr_vec.len() > 10
&& lr_vec.last().is_some_and(|x| x.close_time > server_epoch)
&& lr_vec[lr_vec.len()-1].lr_value < lr_vec[lr_vec.len()-2].lr_value
&& lr_vec[lr_vec.len()-2].lr_value < lr_vec[lr_vec.len()-3].lr_value
&& lr_vec.last().unwrap().r_squared <= 0.01
{
values.closetime = current_info.1;
@ -159,7 +160,7 @@ pub async fn list_up_for_buy(
// }
// remove_keys(&mut filtered_data, keys_to_remove).await;
// Wiliams -50.0 < %R(100)
// Wiliams -40.0 < %R(100)
let mut keys_to_remove: HashSet<String> = HashSet::new();
let mut wpr100_map = wiliams_percent_r(100, &alldata.rt_price_1m_vec, &filtered_data).await?;
let server_epoch = get_server_epoch().await;
@ -168,7 +169,7 @@ pub async fn list_up_for_buy(
if let Some(wpr100_vec) = wpr100_map.get(symbol) {
if wpr100_vec.len() > 15
&& wpr100_vec.last().unwrap().close_time > server_epoch
&& wpr100_vec.last().unwrap().r_value > -50.0 {
&& wpr100_vec.last().unwrap().r_value > -40.0 {
do_buy = true;
}
}
@ -397,7 +398,9 @@ pub async fn list_up_for_sell(all_data: &AllData, futures_exchange_info_map: &Ha
// } 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.is_sign_positive() && lr_vec.last().unwrap().r_squared >= 0.7 {
is_sell = true;
} else if lr_vec[lr_vec.len()-1].lr_value > lr_vec[lr_vec.len()-2].lr_value {
is_sell = true;
}