Add filtering

This commit is contained in:
Sik Yoon 2024-01-14 18:40:10 +09:00
parent 53f53a1af1
commit bae51ccaae

View File

@ -219,7 +219,7 @@ pub async fn list_up_for_sell(
.iter() .iter()
.position(|x| *x.0 == element.symbol); .position(|x| *x.0 == element.symbol);
let supertrend_option_30m = let supertrend_option_30m =
supertrend(&element.symbol, &all_data.rt_price_30m_vec, 20, 1.5, true).await; supertrend(&element.symbol, &all_data.rt_price_30m_vec, 20, 2.0, true).await;
if lot_step_size_option.is_some() if lot_step_size_option.is_some()
&& quote_commission_precision_option.is_some() && quote_commission_precision_option.is_some()
@ -253,6 +253,8 @@ pub async fn list_up_for_sell(
); );
let stoch_rsi_k = stoch_rsis[search_result.unwrap()].1.last().unwrap().k; let stoch_rsi_k = stoch_rsis[search_result.unwrap()].1.last().unwrap().k;
let stoch_rsi_k_prev = stoch_rsis[search_result.unwrap()].1[stoch_rsis[search_result.unwrap()].1.len()-2].k; let stoch_rsi_k_prev = stoch_rsis[search_result.unwrap()].1[stoch_rsis[search_result.unwrap()].1.len()-2].k;
let stoch_rsi_d = stoch_rsis[search_result.unwrap()].1.last().unwrap().d;
let stoch_rsi_d_prev = stoch_rsis[search_result.unwrap()].1[stoch_rsis[search_result.unwrap()].1.len()-2].d;
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()
{ {
@ -276,7 +278,7 @@ pub async fn list_up_for_sell(
&trade_fee_vec, &trade_fee_vec,
) )
.await; .await;
} else if element.pure_profit_percent > 3.0 { } else if element.pure_profit_percent > 5.0 {
limit_order_sell( limit_order_sell(
&element, &element,
element.current_price, element.current_price,
@ -286,7 +288,18 @@ pub async fn list_up_for_sell(
&trade_fee_vec, &trade_fee_vec,
) )
.await; .await;
} else if stoch_rsi_k > 90.0 { } else if stoch_rsi_k >= 95.0 {
limit_order_sell(
&element,
element.current_price,
base_qty_to_be_ordered,
&client,
&exchange_info_vec,
&trade_fee_vec,
)
.await;
} else if stoch_rsi_k < stoch_rsi_d &&
stoch_rsi_k_prev >= stoch_rsi_d_prev {
limit_order_sell( limit_order_sell(
&element, &element,
element.current_price, element.current_price,