From 53f53a1af1a0b2dfdf099eacbbc3fc85172d47ae Mon Sep 17 00:00:00 2001 From: Sik Yoon Date: Sun, 14 Jan 2024 18:02:29 +0900 Subject: [PATCH] Disable threading --- src/strategy_team/strategy_001.rs | 2 +- src/strategy_team/strategy_002.rs | 2 +- src/strategy_team/strategy_004.rs | 2 +- src/strategy_team/strategy_manager.rs | 41 ++++----------------------- 4 files changed, 9 insertions(+), 38 deletions(-) diff --git a/src/strategy_team/strategy_001.rs b/src/strategy_team/strategy_001.rs index 047a5e4..02a939c 100644 --- a/src/strategy_team/strategy_001.rs +++ b/src/strategy_team/strategy_001.rs @@ -12,7 +12,7 @@ use super::{ // SuperTrend length: 20, multiplier: 1.5, BUY signal // ADX(10, 10) < 25.0 pub async fn list_up_for_buy( - alldata: AllData, + alldata: &AllData, ) -> Result<(), Box> { // print rt_price for debugging // let a = alldata.rt_price_30m_vec.iter().position(|a| a.0 == "BTCUSDT"); diff --git a/src/strategy_team/strategy_002.rs b/src/strategy_team/strategy_002.rs index c7ff7df..4048004 100644 --- a/src/strategy_team/strategy_002.rs +++ b/src/strategy_team/strategy_002.rs @@ -11,7 +11,7 @@ use super::{ // BB 30m lowerband + BB 1m lowerband // SuperTrend length: 10, multiplier: 2.5 pub async fn list_up_for_buy( - alldata: AllData, + alldata: &AllData, ) -> Result<(), Box> { // print rt_price for debugging // let a = alldata.rt_price_30m_vec.iter().position(|a| a.0 == "BTCUSDT"); diff --git a/src/strategy_team/strategy_004.rs b/src/strategy_team/strategy_004.rs index 09ff4a5..aeb23f1 100644 --- a/src/strategy_team/strategy_004.rs +++ b/src/strategy_team/strategy_004.rs @@ -12,7 +12,7 @@ use super::{ // SuperTrend length: 20, multiplier: 1.5, BUY signal // ADX(10, 10) < 25.0 pub async fn list_up_for_buy( - alldata: AllData, + alldata: &AllData, ) -> Result<(), Box> { // print rt_price for debugging // let a = alldata.rt_price_30m_vec.iter().position(|a| a.0 == "BTCUSDT"); diff --git a/src/strategy_team/strategy_manager.rs b/src/strategy_team/strategy_manager.rs index 4443efb..505645d 100644 --- a/src/strategy_team/strategy_manager.rs +++ b/src/strategy_team/strategy_manager.rs @@ -32,39 +32,11 @@ struct Record { pub async fn execute_list_up_for_buy( all_data: &AllData, ) -> Result<(), Box> { - let mut task_vec = Vec::new(); - let all_data_c1 = all_data.clone(); - let all_data_c2 = all_data.clone(); - // let all_data_c3 = all_data.clone(); - let all_data_c4 = all_data.clone(); - // let all_data_c5 = all_data.clone(); - let all_data_c6 = all_data.clone(); + crate::strategy_team::strategy_001::list_up_for_buy(all_data).await; + crate::strategy_team::strategy_002::list_up_for_buy(all_data).await; + crate::strategy_team::strategy_004::list_up_for_buy(all_data).await; - task_vec.push(tokio::spawn(async move { - crate::strategy_team::strategy_001::list_up_for_buy(all_data_c1).await; - })); - task_vec.push(tokio::spawn(async move { - crate::strategy_team::strategy_002::list_up_for_buy(all_data_c2).await; - })); - // task_vec.push(tokio::spawn(async move { - // crate::strategy_team::strategy_003::list_up_for_buy(all_data_c3).await; - // })); - task_vec.push(tokio::spawn(async move { - crate::strategy_team::strategy_004::list_up_for_buy(all_data_c4).await; - })); - // task_vec.push(tokio::spawn(async move { - // crate::strategy_team::strategy_005::list_up_for_buy(all_data_c5).await; - // })); - task_vec.push(tokio::spawn(async move { - crate::strategy_team::strategy_006::list_up_for_buy(all_data_c6).await; - })); - // let all_data_ct = all_data.clone(); - // task_vec.push(tokio::spawn(async move { - // crate::strategy_team::strategy_test::strategist_test(all_data_ct).await; - // })); - - try_join_all(task_vec).await?; Ok(()) } @@ -73,10 +45,9 @@ pub async fn execute_list_up_for_sell( exchange_info_vec: &Vec, trade_fee_vec: &Vec, ) -> Result<(), Box> { - crate::strategy_team::strategy_001::list_up_for_sell(&all_data, &exchange_info_vec, &trade_fee_vec).await?; - crate::strategy_team::strategy_002::list_up_for_sell(&all_data, &exchange_info_vec, &trade_fee_vec).await?; - crate::strategy_team::strategy_004::list_up_for_sell(&all_data, &exchange_info_vec, &trade_fee_vec).await?; - crate::strategy_team::strategy_006::list_up_for_sell(&all_data, &exchange_info_vec, &trade_fee_vec).await?; + crate::strategy_team::strategy_001::list_up_for_sell(&all_data, &exchange_info_vec, &trade_fee_vec).await; + crate::strategy_team::strategy_002::list_up_for_sell(&all_data, &exchange_info_vec, &trade_fee_vec).await; + crate::strategy_team::strategy_004::list_up_for_sell(&all_data, &exchange_info_vec, &trade_fee_vec).await; Ok(()) }