Change filtering
This commit is contained in:
parent
bbc30cd242
commit
0b8b8bce04
|
|
@ -1,7 +1,7 @@
|
|||
use crate::value_estimation_team::indicators::bollingerband::bollingerband;
|
||||
|
||||
use super::{
|
||||
dec, decimal_add, decimal_sub, decimal_div, ema, ema_opclo, sma_opclo, exists_record, insert_pre_suggested_coins,
|
||||
dec, decimal_add, decimal_sub, decimal_div, ema, ema_opclo, sma, sma_opclo, exists_record, insert_pre_suggested_coins,
|
||||
limit_order_sell, rsi, select_filled_buy_orders, stoch_rsi, supertrend, try_join_all, AllData,
|
||||
Arc, Client, ClientBuilder, Decimal, EmaData, ExchangeInfo, FilteredData, Mutex, SmaData,
|
||||
RealtimePriceData, RoundingStrategy, RsiData, StochRsiData, SupertrendData, TradeFee, update_record3, adx, AdxData, server_epoch, MacdData, ema_macd,
|
||||
|
|
@ -76,15 +76,15 @@ pub async fn list_up_for_buy(
|
|||
Arc::new(Mutex::new(filtered_data_2nd));
|
||||
let mut task_vec = Vec::new();
|
||||
|
||||
let sma_opclos = sma_opclo(5, &alldata.rt_price_30m_vec, &filtered_data_1st).await?;
|
||||
let ema_opclos = ema_opclo(3, &alldata.rt_price_30m_vec, &filtered_data_1st).await?;
|
||||
let sma_close = sma(5, &alldata.rt_price_30m_vec, &filtered_data_1st).await?;
|
||||
let ema_close = ema(3, &alldata.rt_price_30m_vec, &filtered_data_1st).await?;
|
||||
for element in filtered_data_1st {
|
||||
let mut rt_30m_vec: Vec<RealtimePriceData> = Vec::new();
|
||||
let mut sma_vec: Vec<SmaData> = Vec::new();
|
||||
let mut ema_vec: Vec<EmaData> = Vec::new();
|
||||
let rt_price_30m_vec_c: Vec<(String, Vec<RealtimePriceData>)> = alldata.rt_price_30m_vec.clone();
|
||||
let sma_opclos_c = sma_opclos.clone();
|
||||
let ema_opclos_c = ema_opclos.clone();
|
||||
let sma_opclos_c = sma_close.clone();
|
||||
let ema_opclos_c = ema_close.clone();
|
||||
|
||||
let filtered_data_2nd_arc_c = Arc::clone(&filtered_data_2nd_arc);
|
||||
task_vec.push(tokio::spawn(async move {
|
||||
|
|
@ -206,11 +206,11 @@ pub async fn list_up_for_sell(
|
|||
};
|
||||
filtered_symbol_vec.push(filltered_data);
|
||||
}
|
||||
let sma_opclos = sma_opclo(5, &all_data.rt_price_30m_vec, &filtered_symbol_vec).await?;
|
||||
let ema_opclos = ema_opclo(3, &all_data.rt_price_30m_vec, &filtered_symbol_vec).await?;
|
||||
let sma_close = sma(5, &all_data.rt_price_30m_vec, &filtered_symbol_vec).await?;
|
||||
let ema_close = ema(3, &all_data.rt_price_30m_vec, &filtered_symbol_vec).await?;
|
||||
for element in filled_buy_orders {
|
||||
let sma_result = sma_opclos.iter().position(|x| x.0 == element.symbol);
|
||||
let ema_result = ema_opclos.iter().position(|x| x.0 == element.symbol);
|
||||
let sma_result = sma_close.iter().position(|x| x.0 == element.symbol);
|
||||
let ema_result = ema_close.iter().position(|x| x.0 == element.symbol);
|
||||
if sma_result.is_some() && ema_result.is_some() && element.used_usdt >= dec!(10.0) {
|
||||
let lot_step_size_option = exchange_info_vec
|
||||
.iter()
|
||||
|
|
@ -235,8 +235,8 @@ pub async fn list_up_for_sell(
|
|||
if (element.is_long == 0 || element.is_long == 1)
|
||||
&& !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 &&
|
||||
sma_opclos[sma_result.unwrap()].1[sma_opclos.len()-2].sma_value < ema_opclos[ema_result.unwrap()].1[ema_opclos.len()-2].ema_value
|
||||
if sma_close[sma_result.unwrap()].1.last().unwrap().sma_value > ema_close[ema_result.unwrap()].1.last().unwrap().ema_value &&
|
||||
sma_close[sma_result.unwrap()].1[sma_close.len()-2].sma_value < ema_close[ema_result.unwrap()].1[ema_close.len()-2].ema_value
|
||||
{
|
||||
limit_order_sell(
|
||||
&element,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user