diff --git a/src/strategy_team/future_strategy.rs b/src/strategy_team/future_strategy.rs index 5d67992..522f6f3 100644 --- a/src/strategy_team/future_strategy.rs +++ b/src/strategy_team/future_strategy.rs @@ -29,6 +29,30 @@ pub async fn list_up_for_buy( for symbol in &alldata.valid_symbol_vec { filtered_data.insert(symbol.clone(), FilteredDataValue::new()); } + let server_epoch = get_server_epoch().await; + // current Tema(30) < current Tema(60) + let mut keys_to_remove: HashSet = HashSet::new(); + let tema_15 = tema(15, &alldata.rt_price_1m_vec, &filtered_data).await?; + let tema_60 = tema(60, &alldata.rt_price_1m_vec, &filtered_data).await?; + let server_epoch = get_server_epoch().await; + + let mut do_buy = false; + if let (Some(tema15_vec), Some(tema60_vec)) = (tema_15.get("BTCUSDT"), tema_60.get("BTCUSDT")) { + if tema15_vec.len() > 10 + && tema60_vec.len() > 10 + && tema15_vec.last().unwrap().close_time == tema60_vec.last().unwrap().close_time + && tema15_vec.last().unwrap().close_time > server_epoch + && tema60_vec.last().unwrap().close_time > server_epoch + { + if tema15_vec.last().unwrap().tema_value < tema60_vec.last().unwrap().tema_value { + do_buy = true; + } + } + } + + if do_buy == false { + return Ok(()); + } // Heatmap volume: filtering close price with Extra High is over the previous candle from 30 previous candles let mut keys_to_remove: HashSet = HashSet::new(); @@ -96,9 +120,9 @@ pub async fn list_up_for_sell() -> Result<(), Box= 1.0 { + if element.pure_profit_percent >= 0.6 { is_sell = true; - } else if element.pure_profit_percent <= -1.0 { + } else if element.pure_profit_percent <= -0.8 { is_sell = true; } else if server_epoch - element.transact_time >= (1_800_000) * 1 { // time up selling