Fix wrong filtering

This commit is contained in:
Sik Yoon 2024-01-07 03:14:45 +09:00
parent 36aba8b864
commit e3369c5cfa

View File

@ -115,7 +115,8 @@ pub async fn list_up_for_buy(
}| *close_time, }| *close_time,
); );
if sma_search_result.is_ok() && ema_search_result.is_ok() { if sma_search_result.is_ok() && ema_search_result.is_ok() {
if sma_vec[sma_search_result.unwrap()].sma_value < ema_vec[ema_search_result.unwrap()].ema_value { if sma_vec[sma_search_result.unwrap()].sma_value < ema_vec[ema_search_result.unwrap()].ema_value &&
sma_vec[sma_search_result.unwrap()-1].sma_value > ema_vec[ema_search_result.unwrap()-1].ema_value {
let mut filtered_data_2nd_lock = filtered_data_2nd_arc_c.lock().await; let mut filtered_data_2nd_lock = filtered_data_2nd_arc_c.lock().await;
let mut filtered_data = FilteredData::new(); let mut filtered_data = FilteredData::new();
filtered_data.symbol = element.symbol.clone(); filtered_data.symbol = element.symbol.clone();
@ -234,7 +235,8 @@ pub async fn list_up_for_sell(
if (element.is_long == 0 || element.is_long == 1) if (element.is_long == 0 || element.is_long == 1)
&& !element.current_price.is_zero() && !element.current_price.is_zero()
{ {
if sma_opclos[sma_result.unwrap()].1.last().unwrap().sma_value > ema_opclos[ema_result.unwrap()].1.last().unwrap().ema_value if sma_opclos[sma_result.unwrap()].1.last().unwrap().sma_value > ema_opclos[ema_result.unwrap()].1.last().unwrap().ema_value &&
sma_opclos[sma_result.unwrap()].1[sma_opclos.len()-2].sma_value < ema_opclos[ema_result.unwrap()].1[ema_opclos.len()-2].ema_value
{ {
limit_order_sell( limit_order_sell(
&element, &element,