Change filtering method

This commit is contained in:
Sik Yoon 2023-12-08 02:06:54 +09:00
parent 9753aca93b
commit 572a07e662

View File

@ -257,31 +257,20 @@ pub async fn list_up_for_buy(
supertrend_vec = supertrend_option_1d.unwrap();
if supertrend_vec.len() >= 3 {
let supertrend_search_result = supertrend_vec.binary_search_by_key(
&element.closetime,
|SupertrendData {
band_value,
signal,
area,
close_time,
}| *close_time,
);
if supertrend_search_result.is_ok() {
if supertrend_vec[supertrend_search_result.unwrap()]
.area
.contains("UP")
{
let mut filtered_5th_symbols_lock =
filtered_data_5th_arc_c.lock().await;
let mut filtered_data = FilteredData::new();
filtered_data.symbol = element.symbol.clone();
filtered_data.closetime = element.closetime;
filtered_data.current_price = element.current_price;
filtered_data.stoploss = element.stoploss;
filtered_data.target_price = element.target_price;
if supertrend_vec.last().unwrap()
.area
.contains("UP")
{
let mut filtered_5th_symbols_lock =
filtered_data_5th_arc_c.lock().await;
let mut filtered_data = FilteredData::new();
filtered_data.symbol = element.symbol.clone();
filtered_data.closetime = element.closetime;
filtered_data.current_price = element.current_price;
filtered_data.stoploss = element.stoploss;
filtered_data.target_price = element.target_price;
filtered_5th_symbols_lock.push(filtered_data);
}
filtered_5th_symbols_lock.push(filtered_data);
}
}
}