Move Task#10 into Task#4
This commit is contained in:
parent
52489fd359
commit
ed5d6f86b0
818
src/main.rs
818
src/main.rs
|
|
@ -120,7 +120,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut price_vec: Vec<CoinPriceData> = Vec::new(); // (symbol, price)
|
let mut price_vec: Vec<CoinPriceData> = Vec::new(); // (symbol, price)
|
||||||
let (tx_price_vec, mut rx_price_vec) = watch::channel(price_vec);
|
let (tx_price_vec, mut rx_price_vec) = watch::channel(price_vec);
|
||||||
let mut rx3_price_vec = rx_price_vec.clone();
|
let mut rx3_price_vec = rx_price_vec.clone();
|
||||||
let mut rx4_price_vec = rx_price_vec.clone();
|
|
||||||
let mut rx5_price_vec = rx_price_vec.clone();
|
let mut rx5_price_vec = rx_price_vec.clone();
|
||||||
|
|
||||||
// candle data from endpoint and channels
|
// candle data from endpoint and channels
|
||||||
|
|
@ -817,20 +816,17 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
// 1m
|
// 1m
|
||||||
let interval = String::from("1m");
|
let interval = String::from("1m");
|
||||||
let candle_1m_vec = rx_candle_1m_vec.borrow().clone();
|
let candle_1m_vec = rx_candle_1m_vec.borrow().clone();
|
||||||
let rt_price_1m_vec_read_temp: Vec<(String, Vec<RealtimePriceData>)> =
|
let rt_price_1m_vec_read_temp: Vec<(String, Vec<RealtimePriceData>)> = Vec::new();
|
||||||
Vec::new();
|
let mut rt_price_1m_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> = Vec::new();
|
||||||
let mut rt_price_1m_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> =
|
let result = value_estimation_team::datapoints::price_data::update_realtime_price_data(
|
||||||
Vec::new();
|
&interval,
|
||||||
let result =
|
&candle_1m_vec,
|
||||||
value_estimation_team::datapoints::price_data::update_realtime_price_data(
|
&rt_price_1m_vec_read_temp,
|
||||||
&interval,
|
&mut rt_price_1m_vec_write_temp,
|
||||||
&candle_1m_vec,
|
&price_vec_temp_c,
|
||||||
&rt_price_1m_vec_read_temp,
|
&valid_usdt_trade_vec,
|
||||||
&mut rt_price_1m_vec_write_temp,
|
)
|
||||||
&price_vec_temp_c,
|
.await;
|
||||||
&valid_usdt_trade_vec,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(T) => {
|
Ok(T) => {
|
||||||
|
|
@ -846,16 +842,23 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let interval = String::from("30m");
|
let interval = String::from("30m");
|
||||||
let candle_30m_vec = rx_candle_30m_vec.borrow().clone();
|
let candle_30m_vec = rx_candle_30m_vec.borrow().clone();
|
||||||
let rt_price_1m_vec = rx_rt_price_1m_vec.borrow().clone();
|
let rt_price_1m_vec = rx_rt_price_1m_vec.borrow().clone();
|
||||||
let mut rt_price_30m_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> =
|
let mut rt_price_30m_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> = Vec::new();
|
||||||
Vec::new();
|
|
||||||
|
|
||||||
if !rt_price_1m_vec.is_empty() {
|
if !rt_price_1m_vec.is_empty() {
|
||||||
let result = value_estimation_team::datapoints::price_data::update_realtime_price_data(&interval, &candle_30m_vec, &rt_price_1m_vec, &mut rt_price_30m_vec_write_temp, &price_vec_temp_c, &valid_usdt_trade_vec).await;
|
let result =
|
||||||
|
value_estimation_team::datapoints::price_data::update_realtime_price_data(
|
||||||
|
&interval,
|
||||||
|
&candle_30m_vec,
|
||||||
|
&rt_price_1m_vec,
|
||||||
|
&mut rt_price_30m_vec_write_temp,
|
||||||
|
&price_vec_temp_c,
|
||||||
|
&valid_usdt_trade_vec,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(T) => {
|
Ok(T) => {
|
||||||
tx_rt_price_30m_vec
|
tx_rt_price_30m_vec.send_modify(|vec| *vec = rt_price_30m_vec_write_temp);
|
||||||
.send_modify(|vec| *vec = rt_price_30m_vec_write_temp);
|
|
||||||
tx_task10
|
tx_task10
|
||||||
.send(10)
|
.send(10)
|
||||||
.expect("The mpsc channel has been closed.");
|
.expect("The mpsc channel has been closed.");
|
||||||
|
|
@ -868,16 +871,23 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let interval = String::from("1d");
|
let interval = String::from("1d");
|
||||||
let candle_1d_vec = rx_candle_1d_vec.borrow().clone();
|
let candle_1d_vec = rx_candle_1d_vec.borrow().clone();
|
||||||
let rt_price_30m_vec = rx_rt_price_30m_vec.borrow().clone();
|
let rt_price_30m_vec = rx_rt_price_30m_vec.borrow().clone();
|
||||||
let mut rt_price_1d_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> =
|
let mut rt_price_1d_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> = Vec::new();
|
||||||
Vec::new();
|
|
||||||
|
|
||||||
if !rt_price_30m_vec.is_empty() {
|
if !rt_price_30m_vec.is_empty() {
|
||||||
let result = value_estimation_team::datapoints::price_data::update_realtime_price_data(&interval, &candle_1d_vec, &rt_price_30m_vec, &mut rt_price_1d_vec_write_temp, &price_vec_temp_c, &valid_usdt_trade_vec).await;
|
let result =
|
||||||
|
value_estimation_team::datapoints::price_data::update_realtime_price_data(
|
||||||
|
&interval,
|
||||||
|
&candle_1d_vec,
|
||||||
|
&rt_price_30m_vec,
|
||||||
|
&mut rt_price_1d_vec_write_temp,
|
||||||
|
&price_vec_temp_c,
|
||||||
|
&valid_usdt_trade_vec,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(T) => {
|
Ok(T) => {
|
||||||
tx_rt_price_1d_vec
|
tx_rt_price_1d_vec.send_modify(|vec| *vec = rt_price_1d_vec_write_temp);
|
||||||
.send_modify(|vec| *vec = rt_price_1d_vec_write_temp);
|
|
||||||
tx_task10
|
tx_task10
|
||||||
.send(10)
|
.send(10)
|
||||||
.expect("The mpsc channel has been closed.");
|
.expect("The mpsc channel has been closed.");
|
||||||
|
|
@ -918,7 +928,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// sleep as much as the loop recurs per 1 seconds if all operation finished within 1 seconds.
|
// sleep as much as the loop recurs per 1 seconds if all operation finished within 1 seconds.
|
||||||
elapsed_time = instant.elapsed().as_millis();
|
elapsed_time = instant.elapsed().as_millis();
|
||||||
if 500 > elapsed_time {
|
if 500 > elapsed_time {
|
||||||
|
|
@ -1040,616 +1049,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// Task#10: make realtime price data of 1m, 30m, 1d, 1w and 1mon
|
|
||||||
// tokio::task::spawn(async move {
|
|
||||||
// let mut elapsed_time = 0;
|
|
||||||
// if RUNNING_MODE == REAL || RUNNING_MODE == SIMUL {
|
|
||||||
// sleep(Duration::from_secs(30)).await;
|
|
||||||
// } else {
|
|
||||||
// sleep(Duration::from_secs(5)).await;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// loop {
|
|
||||||
// let instant = Instant::now();
|
|
||||||
// let price_changed = rx_price_vec.changed().await;
|
|
||||||
// if price_changed.is_ok() {
|
|
||||||
// let price_vec = rx_price_vec.borrow().clone();
|
|
||||||
// let valid_usdt_trade_vec = rx_valid_usdt_trade_vec.borrow().clone();
|
|
||||||
|
|
||||||
// if !price_vec.is_empty() {
|
|
||||||
// // 1m
|
|
||||||
// let interval = String::from("1m");
|
|
||||||
// let candle_1m_vec = rx_candle_1m_vec.borrow().clone();
|
|
||||||
// let rt_price_1m_vec_read_temp: Vec<(String, Vec<RealtimePriceData>)> =
|
|
||||||
// Vec::new();
|
|
||||||
// let mut rt_price_1m_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> =
|
|
||||||
// Vec::new();
|
|
||||||
// let result =
|
|
||||||
// value_estimation_team::datapoints::price_data::update_realtime_price_data(
|
|
||||||
// &interval,
|
|
||||||
// &candle_1m_vec,
|
|
||||||
// &rt_price_1m_vec_read_temp,
|
|
||||||
// &mut rt_price_1m_vec_write_temp,
|
|
||||||
// &price_vec,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
|
|
||||||
// match result {
|
|
||||||
// Ok(T) => {
|
|
||||||
// tx_rt_price_1m_vec.send_modify(|vec| *vec = rt_price_1m_vec_write_temp);
|
|
||||||
// tx_task10
|
|
||||||
// .send(10)
|
|
||||||
// .expect("The mpsc channel has been closed.");
|
|
||||||
// }
|
|
||||||
// Err(E) => {}
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 30m
|
|
||||||
// let interval = String::from("30m");
|
|
||||||
// let candle_30m_vec = rx_candle_30m_vec.borrow().clone();
|
|
||||||
// let rt_price_1m_vec = rx_rt_price_1m_vec.borrow().clone();
|
|
||||||
// let mut rt_price_30m_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> =
|
|
||||||
// Vec::new();
|
|
||||||
|
|
||||||
// if !rt_price_1m_vec.is_empty() {
|
|
||||||
// let result = value_estimation_team::datapoints::price_data::update_realtime_price_data(&interval, &candle_30m_vec, &rt_price_1m_vec, &mut rt_price_30m_vec_write_temp, &price_vec, &valid_usdt_trade_vec).await;
|
|
||||||
|
|
||||||
// match result {
|
|
||||||
// Ok(T) => {
|
|
||||||
// tx_rt_price_30m_vec
|
|
||||||
// .send_modify(|vec| *vec = rt_price_30m_vec_write_temp);
|
|
||||||
// tx_task10
|
|
||||||
// .send(10)
|
|
||||||
// .expect("The mpsc channel has been closed.");
|
|
||||||
// }
|
|
||||||
// Err(E) => {}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 1d
|
|
||||||
// let interval = String::from("1d");
|
|
||||||
// let candle_1d_vec = rx_candle_1d_vec.borrow().clone();
|
|
||||||
// let rt_price_30m_vec = rx_rt_price_30m_vec.borrow().clone();
|
|
||||||
// let mut rt_price_1d_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> =
|
|
||||||
// Vec::new();
|
|
||||||
|
|
||||||
// if !rt_price_30m_vec.is_empty() {
|
|
||||||
// let result = value_estimation_team::datapoints::price_data::update_realtime_price_data(&interval, &candle_1d_vec, &rt_price_30m_vec, &mut rt_price_1d_vec_write_temp, &price_vec, &valid_usdt_trade_vec).await;
|
|
||||||
|
|
||||||
// match result {
|
|
||||||
// Ok(T) => {
|
|
||||||
// tx_rt_price_1d_vec
|
|
||||||
// .send_modify(|vec| *vec = rt_price_1d_vec_write_temp);
|
|
||||||
// tx_task10
|
|
||||||
// .send(10)
|
|
||||||
// .expect("The mpsc channel has been closed.");
|
|
||||||
// }
|
|
||||||
// Err(E) => {}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // { // 1w
|
|
||||||
// // let interval = String::from("1w");
|
|
||||||
// // let candle_1w_vec = rx_candle_1w_vec.borrow().clone();
|
|
||||||
// // let rt_price_1d_vec = rx_rt_price_1d_vec.borrow().clone();
|
|
||||||
// // let mut rt_price_1w_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> = Vec::new();
|
|
||||||
// // let result = value_estimation_team::datapoints::price_data::update_realtime_price_data(&interval, &candle_1w_vec, &rt_price_1d_vec, &mut rt_price_1w_vec_write_temp, &price_vec, &valid_usdt_trade_vec).await;
|
|
||||||
|
|
||||||
// // match result {
|
|
||||||
// // Ok(T) => {
|
|
||||||
// // tx_rt_price_1w_vec.send_modify(|vec| *vec = rt_price_1w_vec_write_temp);
|
|
||||||
// // tx_task10.send(10).expect("The mpsc channel has been closed.");
|
|
||||||
// // }
|
|
||||||
// // Err(E) => {}
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// // { // 1mon
|
|
||||||
// // let interval = String::from("1mon");
|
|
||||||
// // let candle_1mon_vec = rx_candle_1mon_vec.borrow().clone();
|
|
||||||
// // let rt_price_1w_vec = rx_rt_price_1w_vec.borrow().clone();
|
|
||||||
// // let mut rt_price_1mon_vec_write_temp: Vec<(String, Vec<RealtimePriceData>)> = Vec::new();
|
|
||||||
// // let result = value_estimation_team::datapoints::price_data::update_realtime_price_data(&interval, &candle_1mon_vec, &rt_price_1w_vec, &mut rt_price_1mon_vec_write_temp, &price_vec, &valid_usdt_trade_vec).await;
|
|
||||||
|
|
||||||
// // match result {
|
|
||||||
// // Ok(T) => {
|
|
||||||
// // tx_rt_price_1mon_vec.send_modify(|vec| *vec = rt_price_1mon_vec_write_temp);
|
|
||||||
// // tx_task10.send(10).expect("The mpsc channel has been closed.");
|
|
||||||
// // }
|
|
||||||
// // Err(E) => {}
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // sleep as much as the loop recurs per 1 second if all operation finished within 1 second.
|
|
||||||
// elapsed_time = instant.elapsed().as_millis();
|
|
||||||
// if 250 > elapsed_time {
|
|
||||||
// sleep(Duration::from_millis((250 - elapsed_time) as u64)).await;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// Task#11
|
|
||||||
// SMA, EMA, RSI, Stoch RSI, BollingerBand (3, 10, 30) for candle 1m, 30m, 1d, 1w, and 1mon
|
|
||||||
// tokio::task::spawn(async move {
|
|
||||||
// let moving_number_vec = vec![3, 10, 30];
|
|
||||||
// sleep(Duration::from_secs(10)).await;
|
|
||||||
// let mut elapsed_time = 0;
|
|
||||||
// loop {
|
|
||||||
// let instant = Instant::now();
|
|
||||||
// let valid_usdt_trade_vec = rx2_valid_usdt_trade_vec.borrow().clone();
|
|
||||||
// let rt_price_1m_vec = rx2_rt_price_1m_vec.borrow().clone();
|
|
||||||
// let rt_price_30m_vec = rx2_rt_price_30m_vec.borrow().clone();
|
|
||||||
// let rt_price_1d_vec = rx2_rt_price_1d_vec.borrow().clone();
|
|
||||||
// let rt_price_1w_vec = rx2_rt_price_1w_vec.borrow().clone();
|
|
||||||
// let rt_price_1mon_vec = rx2_rt_price_1mon_vec.borrow().clone();
|
|
||||||
|
|
||||||
// for moving_number_element in &moving_number_vec {
|
|
||||||
// // calculate SMA
|
|
||||||
// let mut sma_1m_data: Vec<(String, Vec<SmaData>)> = Vec::new();
|
|
||||||
// let mut sma_30m_data: Vec<(String, Vec<SmaData>)> = Vec::new();
|
|
||||||
// let mut sma_1d_data: Vec<(String, Vec<SmaData>)> = Vec::new();
|
|
||||||
// // let mut sma_1w_data: Vec<(String, Vec<SmaData>)> = Vec::new();
|
|
||||||
// // let mut sma_1mon_data: Vec<(String, Vec<SmaData>)> = Vec::new();
|
|
||||||
// let sma_1m_result = value_estimation_team::indicators::sma::sma(
|
|
||||||
// *moving_number_element,
|
|
||||||
// &rt_price_1m_vec,
|
|
||||||
// &mut sma_1m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// let sma_30m_result = value_estimation_team::indicators::sma::sma(
|
|
||||||
// *moving_number_element,
|
|
||||||
// &rt_price_30m_vec,
|
|
||||||
// &mut sma_30m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// let sma_1d_result = value_estimation_team::indicators::sma::sma(
|
|
||||||
// *moving_number_element,
|
|
||||||
// &rt_price_1d_vec,
|
|
||||||
// &mut sma_1d_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// // let sma_1w_result = value_estimation_team::indicators::sma::sma(*moving_number_element, &rt_price_1w_vec, &mut sma_1w_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // let sma_1mon_result = value_estimation_team::indicators::sma::sma(*moving_number_element, &rt_price_1mon_vec, &mut sma_1mon_data, &valid_usdt_trade_vec).await;
|
|
||||||
|
|
||||||
// // calculate EMA
|
|
||||||
// let mut ema_1m_data: Vec<(String, Vec<EmaData>)> = Vec::new();
|
|
||||||
// let mut ema_30m_data: Vec<(String, Vec<EmaData>)> = Vec::new();
|
|
||||||
// let mut ema_1d_data: Vec<(String, Vec<EmaData>)> = Vec::new();
|
|
||||||
// // let mut ema_1w_data: Vec<(String, Vec<EmaData>)> = Vec::new();
|
|
||||||
// // let mut ema_1mon_data: Vec<(String, Vec<EmaData>)> = Vec::new();
|
|
||||||
// let ema_1m_result = value_estimation_team::indicators::ema::ema(
|
|
||||||
// *moving_number_element,
|
|
||||||
// &rt_price_1m_vec,
|
|
||||||
// &mut ema_1m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// let ema_30m_result = value_estimation_team::indicators::ema::ema(
|
|
||||||
// *moving_number_element,
|
|
||||||
// &rt_price_30m_vec,
|
|
||||||
// &mut ema_30m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// let ema_1d_result = value_estimation_team::indicators::ema::ema(
|
|
||||||
// *moving_number_element,
|
|
||||||
// &rt_price_1d_vec,
|
|
||||||
// &mut ema_1d_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// // let ema_1w_result = value_estimation_team::indicators::ema::ema(*moving_number_element, &rt_price_1w_vec, &mut ema_1w_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // let ema_1mon_result = value_estimation_team::indicators::ema::ema(*moving_number_element, &rt_price_1mon_vec, &mut ema_1mon_data, &valid_usdt_trade_vec).await;
|
|
||||||
|
|
||||||
// // // calculate TEMA
|
|
||||||
// // let mut tema_1m_data: Vec<(String, Vec<(f64, i64)>)> = Vec::new();
|
|
||||||
// // let mut tema_30m_data: Vec<(String, Vec<(f64, i64)>)> = Vec::new();
|
|
||||||
// // let mut tema_1d_data: Vec<(String, Vec<(f64, i64)>)> = Vec::new();
|
|
||||||
// // let mut tema_1w_data: Vec<(String, Vec<(f64, i64)>)> = Vec::new();
|
|
||||||
// // let mut tema_1mon_data: Vec<(String, Vec<(f64, i64)>)> = Vec::new();
|
|
||||||
// // value_estimation_team::indicators::tema::tema(*moving_number_element, &ema_1m_data, &mut tema_1m_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // value_estimation_team::indicators::tema::tema(*moving_number_element, &ema_30m_data, &mut tema_30m_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // value_estimation_team::indicators::tema::tema(*moving_number_element, &ema_1d_data, &mut tema_1d_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // value_estimation_team::indicators::tema::tema(*moving_number_element, &ema_1w_data, &mut tema_1w_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // value_estimation_team::indicators::tema::tema(*moving_number_element, &ema_1mon_data, &mut tema_1mon_data, &valid_usdt_trade_vec).await;
|
|
||||||
|
|
||||||
// // calculate RSI
|
|
||||||
// let mut rsi_1m_data: Vec<(String, Vec<RsiData>)> = Vec::new();
|
|
||||||
// let mut rsi_30m_data: Vec<(String, Vec<RsiData>)> = Vec::new();
|
|
||||||
// let mut rsi_1d_data: Vec<(String, Vec<RsiData>)> = Vec::new();
|
|
||||||
// // let mut rsi_1w_data: Vec<(String, Vec<RsiData>)> = Vec::new();
|
|
||||||
// // let mut rsi_1mon_data: Vec<(String, Vec<RsiData>)> = Vec::new();
|
|
||||||
// let rsi_1m_result = value_estimation_team::indicators::rsi::rsi(
|
|
||||||
// *moving_number_element,
|
|
||||||
// &rt_price_1m_vec,
|
|
||||||
// &mut rsi_1m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// let rsi_30m_result = value_estimation_team::indicators::rsi::rsi(
|
|
||||||
// *moving_number_element,
|
|
||||||
// &rt_price_30m_vec,
|
|
||||||
// &mut rsi_30m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// let rsi_1d_result = value_estimation_team::indicators::rsi::rsi(
|
|
||||||
// *moving_number_element,
|
|
||||||
// &rt_price_1d_vec,
|
|
||||||
// &mut rsi_1d_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// // let rsi_1w_result = value_estimation_team::indicators::rsi::rsi(*moving_number_element, &rt_price_1w_vec, &mut rsi_1w_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // let rsi_1mon_result = value_estimation_team::indicators::rsi::rsi(*moving_number_element, &rt_price_1mon_vec, &mut rsi_1mon_data, &valid_usdt_trade_vec).await;
|
|
||||||
|
|
||||||
// // calculate Stoch RSI
|
|
||||||
// let mut stoch_rsi_1m_k_data: Vec<(String, Vec<StochRsiKData>)> = Vec::new();
|
|
||||||
// let mut stoch_rsi_1m_d_data: Vec<(String, Vec<StochRsiDData>)> = Vec::new();
|
|
||||||
// let mut stoch_rsi_1m_result;
|
|
||||||
// if rsi_1m_result.is_ok() {
|
|
||||||
// if *moving_number_element == 10 {
|
|
||||||
// stoch_rsi_1m_result =
|
|
||||||
// value_estimation_team::indicators::stoch_rsi::stoch_rsi(
|
|
||||||
// &rsi_1m_data,
|
|
||||||
// 3,
|
|
||||||
// &mut stoch_rsi_1m_k_data,
|
|
||||||
// &mut stoch_rsi_1m_d_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// if stoch_rsi_1m_result.is_ok() {
|
|
||||||
// tx_stoch_rsi3_1m_3_k_data.send_modify(|vec| *vec = stoch_rsi_1m_k_data);
|
|
||||||
// tx_stoch_rsi3_1m_3_d_data.send_modify(|vec| *vec = stoch_rsi_1m_d_data);
|
|
||||||
// }
|
|
||||||
// } else if *moving_number_element == 30 {
|
|
||||||
// stoch_rsi_1m_result =
|
|
||||||
// value_estimation_team::indicators::stoch_rsi::stoch_rsi(
|
|
||||||
// &rsi_1m_data,
|
|
||||||
// 30,
|
|
||||||
// &mut stoch_rsi_1m_k_data,
|
|
||||||
// &mut stoch_rsi_1m_d_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// if stoch_rsi_1m_result.is_ok() {
|
|
||||||
// tx_stoch_rsi30_1m_30_k_data
|
|
||||||
// .send_modify(|vec| *vec = stoch_rsi_1m_k_data);
|
|
||||||
// tx_stoch_rsi30_1m_30_d_data
|
|
||||||
// .send_modify(|vec| *vec = stoch_rsi_1m_d_data);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // calculate BollingerBand
|
|
||||||
// let mut bb3_1m_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// let mut bb3_30m_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// let mut bb3_1d_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// // let mut bb3_1w_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// // let mut bb3_1mon_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// let mut bb10_1m_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// let mut bb10_30m_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// let mut bb10_1d_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// // let mut bb10_1w_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// // let mut bb10_1mon_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// let mut bb30_1m_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// let mut bb30_30m_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// let mut bb30_1d_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// // let mut bb30_1w_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// // let mut bb30_1mon_data: Vec<(String, Vec<BollingerBandData>)> = Vec::new();
|
|
||||||
// let mut bb_1m_result;
|
|
||||||
// let mut bb_30m_result;
|
|
||||||
// let mut bb_1d_result;
|
|
||||||
// // let mut bb_1w_result;
|
|
||||||
// // let mut bb_1mon_result;
|
|
||||||
|
|
||||||
// match moving_number_element {
|
|
||||||
// 3 => {
|
|
||||||
// bb_1m_result =
|
|
||||||
// value_estimation_team::indicators::bollingerband::bollingerband(
|
|
||||||
// *moving_number_element,
|
|
||||||
// 3.0,
|
|
||||||
// &sma_1m_data,
|
|
||||||
// &rt_price_1m_vec,
|
|
||||||
// &mut bb3_1m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// bb_30m_result =
|
|
||||||
// value_estimation_team::indicators::bollingerband::bollingerband(
|
|
||||||
// *moving_number_element,
|
|
||||||
// 3.0,
|
|
||||||
// &sma_30m_data,
|
|
||||||
// &rt_price_30m_vec,
|
|
||||||
// &mut bb3_30m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// bb_1d_result =
|
|
||||||
// value_estimation_team::indicators::bollingerband::bollingerband(
|
|
||||||
// *moving_number_element,
|
|
||||||
// 3.0,
|
|
||||||
// &sma_1d_data,
|
|
||||||
// &rt_price_1d_vec,
|
|
||||||
// &mut bb3_1d_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// // bb_1w_result = value_estimation_team::indicators::bollingerband::bollingerband(*moving_number_element, 2.0, &sma_1w_data, &rt_price_1w_vec, &mut bb3_1w_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // bb_1mon_result = value_estimation_team::indicators::bollingerband::bollingerband(*moving_number_element, 2.0, &sma_1mon_data, &rt_price_1mon_vec, &mut bb3_1mon_data, &valid_usdt_trade_vec).await;
|
|
||||||
// }
|
|
||||||
// 10 => {
|
|
||||||
// bb_1m_result =
|
|
||||||
// value_estimation_team::indicators::bollingerband::bollingerband(
|
|
||||||
// *moving_number_element,
|
|
||||||
// 3.0,
|
|
||||||
// &sma_1m_data,
|
|
||||||
// &rt_price_1m_vec,
|
|
||||||
// &mut bb10_1m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// bb_30m_result =
|
|
||||||
// value_estimation_team::indicators::bollingerband::bollingerband(
|
|
||||||
// *moving_number_element,
|
|
||||||
// 3.0,
|
|
||||||
// &sma_30m_data,
|
|
||||||
// &rt_price_30m_vec,
|
|
||||||
// &mut bb10_30m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// bb_1d_result =
|
|
||||||
// value_estimation_team::indicators::bollingerband::bollingerband(
|
|
||||||
// *moving_number_element,
|
|
||||||
// 3.0,
|
|
||||||
// &sma_1d_data,
|
|
||||||
// &rt_price_1d_vec,
|
|
||||||
// &mut bb10_1d_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// // bb_1w_result = value_estimation_team::indicators::bollingerband::bollingerband(*moving_number_element, 2.0, &sma_1w_data, &rt_price_1w_vec, &mut bb10_1w_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // bb_1mon_result = value_estimation_team::indicators::bollingerband::bollingerband(*moving_number_element, 2.0, &sma_1mon_data, &rt_price_1mon_vec, &mut bb10_1mon_data, &valid_usdt_trade_vec).await;
|
|
||||||
// }
|
|
||||||
// 30 => {
|
|
||||||
// bb_1m_result =
|
|
||||||
// value_estimation_team::indicators::bollingerband::bollingerband(
|
|
||||||
// *moving_number_element,
|
|
||||||
// 3.0,
|
|
||||||
// &sma_1m_data,
|
|
||||||
// &rt_price_1m_vec,
|
|
||||||
// &mut bb30_1m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// bb_30m_result =
|
|
||||||
// value_estimation_team::indicators::bollingerband::bollingerband(
|
|
||||||
// *moving_number_element,
|
|
||||||
// 3.0,
|
|
||||||
// &sma_30m_data,
|
|
||||||
// &rt_price_30m_vec,
|
|
||||||
// &mut bb30_30m_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// bb_1d_result =
|
|
||||||
// value_estimation_team::indicators::bollingerband::bollingerband(
|
|
||||||
// *moving_number_element,
|
|
||||||
// 3.0,
|
|
||||||
// &sma_1d_data,
|
|
||||||
// &rt_price_1d_vec,
|
|
||||||
// &mut bb30_1d_data,
|
|
||||||
// &valid_usdt_trade_vec,
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// // bb_1w_result = value_estimation_team::indicators::bollingerband::bollingerband(*moving_number_element, 2.0, &sma_1w_data, &rt_price_1w_vec, &mut bb30_1w_data, &valid_usdt_trade_vec).await;
|
|
||||||
// // bb_1mon_result = value_estimation_team::indicators::bollingerband::bollingerband(*moving_number_element, 2.0, &sma_1mon_data, &rt_price_1mon_vec, &mut bb30_1mon_data, &valid_usdt_trade_vec).await;
|
|
||||||
// }
|
|
||||||
// _ => {
|
|
||||||
// bb_1m_result = Ok(());
|
|
||||||
// bb_30m_result = Ok(());
|
|
||||||
// bb_1d_result = Ok(());
|
|
||||||
// // bb_1w_result = Ok(());
|
|
||||||
// // bb_1mon_result = Ok(());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// match moving_number_element {
|
|
||||||
// 3 => {
|
|
||||||
// if sma_1m_result.is_ok() {
|
|
||||||
// tx_sma3_1m_data.send_modify(|vec| *vec = sma_1m_data);
|
|
||||||
// }
|
|
||||||
// if sma_30m_result.is_ok() {
|
|
||||||
// tx_sma3_30m_data.send_modify(|vec| *vec = sma_30m_data);
|
|
||||||
// }
|
|
||||||
// if sma_1d_result.is_ok() {
|
|
||||||
// tx_sma3_1d_data.send_modify(|vec| *vec = sma_1d_data);
|
|
||||||
// }
|
|
||||||
// // if sma_1w_result.is_ok() { tx_sma3_1w_data.send_modify(|vec| *vec = sma_1w_data); }
|
|
||||||
// // if sma_1mon_result.is_ok() { tx_sma3_1mon_data.send_modify(|vec| *vec = sma_1mon_data); }
|
|
||||||
|
|
||||||
// if ema_1m_result.is_ok() {
|
|
||||||
// tx_ema3_1m_data.send_modify(|vec| *vec = ema_1m_data);
|
|
||||||
// }
|
|
||||||
// if ema_30m_result.is_ok() {
|
|
||||||
// tx_ema3_30m_data.send_modify(|vec| *vec = ema_30m_data);
|
|
||||||
// }
|
|
||||||
// if ema_1d_result.is_ok() {
|
|
||||||
// tx_ema3_1d_data.send_modify(|vec| *vec = ema_1d_data);
|
|
||||||
// }
|
|
||||||
// // if ema_1w_result.is_ok() { tx_ema3_1w_data.send_modify(|vec| *vec = ema_1w_data); }
|
|
||||||
// // if ema_1mon_result.is_ok() { tx_ema3_1mon_data.send_modify(|vec| *vec = ema_1mon_data); }
|
|
||||||
|
|
||||||
// // tx_tema3_1m_data.send_modify(|vec| *vec = tema_1m_data);
|
|
||||||
// // tx_tema3_30m_data.send_modify(|vec| *vec = tema_30m_data);
|
|
||||||
// // tx_tema3_1d_data.send_modify(|vec| *vec = tema_1d_data);
|
|
||||||
// // tx_tema3_1w_data.send_modify(|vec| *vec = tema_1w_data);
|
|
||||||
// // tx_tema3_1mon_data.send_modify(|vec| *vec = tema_1mon_data);
|
|
||||||
|
|
||||||
// if rsi_1m_result.is_ok() {
|
|
||||||
// tx_rsi3_1m_data.send_modify(|vec| *vec = rsi_1m_data);
|
|
||||||
// }
|
|
||||||
// if rsi_30m_result.is_ok() {
|
|
||||||
// tx_rsi3_30m_data.send_modify(|vec| *vec = rsi_30m_data);
|
|
||||||
// }
|
|
||||||
// if rsi_1d_result.is_ok() {
|
|
||||||
// tx_rsi3_1d_data.send_modify(|vec| *vec = rsi_1d_data);
|
|
||||||
// }
|
|
||||||
// // if rsi_1w_result.is_ok() { tx_rsi3_1w_data.send_modify(|vec| *vec = rsi_1w_data); }
|
|
||||||
// // if rsi_1mon_result.is_ok() { tx_rsi3_1mon_data.send_modify(|vec| *vec = rsi_1mon_data); }
|
|
||||||
|
|
||||||
// if bb_1m_result.is_ok() {
|
|
||||||
// tx_bb3_1m_data.send_modify(|vec| *vec = bb3_1m_data);
|
|
||||||
// }
|
|
||||||
// if bb_30m_result.is_ok() {
|
|
||||||
// tx_bb3_30m_data.send_modify(|vec| *vec = bb3_30m_data);
|
|
||||||
// }
|
|
||||||
// if bb_1d_result.is_ok() {
|
|
||||||
// tx_bb3_1d_data.send_modify(|vec| *vec = bb3_1d_data);
|
|
||||||
// }
|
|
||||||
// // if bb_1w_result.is_ok() { tx_bb3_1w_data.send_modify(|vec| *vec = bb3_1w_data); }
|
|
||||||
// // if bb_1mon_result.is_ok() { tx_bb3_1mon_data.send_modify(|vec| *vec = bb3_1mon_data); }
|
|
||||||
|
|
||||||
// tx_task11
|
|
||||||
// .send(11)
|
|
||||||
// .expect("The mpsc channel has been closed.");
|
|
||||||
// }
|
|
||||||
// 10 => {
|
|
||||||
// if sma_1m_result.is_ok() {
|
|
||||||
// tx_sma10_1m_data.send_modify(|vec| *vec = sma_1m_data);
|
|
||||||
// }
|
|
||||||
// if sma_30m_result.is_ok() {
|
|
||||||
// tx_sma10_30m_data.send_modify(|vec| *vec = sma_30m_data);
|
|
||||||
// }
|
|
||||||
// if sma_1d_result.is_ok() {
|
|
||||||
// tx_sma10_1d_data.send_modify(|vec| *vec = sma_1d_data);
|
|
||||||
// }
|
|
||||||
// // if sma_1w_result.is_ok() { tx_sma10_1w_data.send_modify(|vec| *vec = sma_1w_data); }
|
|
||||||
// // if sma_1mon_result.is_ok() { tx_sma10_1mon_data.send_modify(|vec| *vec = sma_1mon_data); }
|
|
||||||
|
|
||||||
// if ema_1m_result.is_ok() {
|
|
||||||
// tx_ema10_1m_data.send_modify(|vec| *vec = ema_1m_data);
|
|
||||||
// }
|
|
||||||
// if ema_30m_result.is_ok() {
|
|
||||||
// tx_ema10_30m_data.send_modify(|vec| *vec = ema_30m_data);
|
|
||||||
// }
|
|
||||||
// if ema_1d_result.is_ok() {
|
|
||||||
// tx_ema10_1d_data.send_modify(|vec| *vec = ema_1d_data);
|
|
||||||
// }
|
|
||||||
// // if ema_1w_result.is_ok() { tx_ema10_1w_data.send_modify(|vec| *vec = ema_1w_data); }
|
|
||||||
// // if ema_1mon_result.is_ok() { tx_ema10_1mon_data.send_modify(|vec| *vec = ema_1mon_data); }
|
|
||||||
|
|
||||||
// // tx_tema10_1m_data.send_modify(|vec| *vec = tema_1m_data);
|
|
||||||
// // tx_tema10_30m_data.send_modify(|vec| *vec = tema_30m_data);
|
|
||||||
// // tx_tema10_1d_data.send_modify(|vec| *vec = tema_1d_data);
|
|
||||||
// // tx_tema10_1w_data.send_modify(|vec| *vec = tema_1w_data);
|
|
||||||
// // tx_tema10_1mon_data.send_modify(|vec| *vec = tema_1mon_data);
|
|
||||||
|
|
||||||
// if rsi_1m_result.is_ok() {
|
|
||||||
// tx_rsi10_1m_data.send_modify(|vec| *vec = rsi_1m_data);
|
|
||||||
// }
|
|
||||||
// if rsi_30m_result.is_ok() {
|
|
||||||
// tx_rsi10_30m_data.send_modify(|vec| *vec = rsi_30m_data);
|
|
||||||
// }
|
|
||||||
// if rsi_1d_result.is_ok() {
|
|
||||||
// tx_rsi10_1d_data.send_modify(|vec| *vec = rsi_1d_data);
|
|
||||||
// }
|
|
||||||
// // if rsi_1w_result.is_ok() { tx_rsi10_1w_data.send_modify(|vec| *vec = rsi_1w_data); }
|
|
||||||
// // if rsi_1mon_result.is_ok() { tx_rsi10_1mon_data.send_modify(|vec| *vec = rsi_1mon_data); }
|
|
||||||
|
|
||||||
// if bb_1m_result.is_ok() {
|
|
||||||
// tx_bb10_1m_data.send_modify(|vec| *vec = bb10_1m_data);
|
|
||||||
// }
|
|
||||||
// if bb_30m_result.is_ok() {
|
|
||||||
// tx_bb10_30m_data.send_modify(|vec| *vec = bb10_30m_data);
|
|
||||||
// }
|
|
||||||
// if bb_1d_result.is_ok() {
|
|
||||||
// tx_bb10_1d_data.send_modify(|vec| *vec = bb10_1d_data);
|
|
||||||
// }
|
|
||||||
// // if bb_1w_result.is_ok() { tx_bb10_1w_data.send_modify(|vec| *vec = bb10_1w_data); }
|
|
||||||
// // if bb_1mon_result.is_ok() { tx_bb10_1mon_data.send_modify(|vec| *vec = bb10_1mon_data); }
|
|
||||||
|
|
||||||
// tx_task11
|
|
||||||
// .send(11)
|
|
||||||
// .expect("The mpsc channel has been closed.");
|
|
||||||
// }
|
|
||||||
// 30 => {
|
|
||||||
// if sma_1m_result.is_ok() {
|
|
||||||
// tx_sma30_1m_data.send_modify(|vec| *vec = sma_1m_data);
|
|
||||||
// }
|
|
||||||
// if sma_30m_result.is_ok() {
|
|
||||||
// tx_sma30_30m_data.send_modify(|vec| *vec = sma_30m_data);
|
|
||||||
// }
|
|
||||||
// if sma_1d_result.is_ok() {
|
|
||||||
// tx_sma30_1d_data.send_modify(|vec| *vec = sma_1d_data);
|
|
||||||
// }
|
|
||||||
// // if sma_1w_result.is_ok() { tx_sma30_1w_data.send_modify(|vec| *vec = sma_1w_data); }
|
|
||||||
// // if sma_1mon_result.is_ok() { tx_sma30_1mon_data.send_modify(|vec| *vec = sma_1mon_data); }
|
|
||||||
|
|
||||||
// if ema_1m_result.is_ok() {
|
|
||||||
// tx_ema30_1m_data.send_modify(|vec| *vec = ema_1m_data);
|
|
||||||
// }
|
|
||||||
// if ema_30m_result.is_ok() {
|
|
||||||
// tx_ema30_30m_data.send_modify(|vec| *vec = ema_30m_data);
|
|
||||||
// }
|
|
||||||
// if ema_1d_result.is_ok() {
|
|
||||||
// tx_ema30_1d_data.send_modify(|vec| *vec = ema_1d_data);
|
|
||||||
// }
|
|
||||||
// // if ema_1w_result.is_ok() { tx_ema30_1w_data.send_modify(|vec| *vec = ema_1w_data); }
|
|
||||||
// // if ema_1mon_result.is_ok() { tx_ema30_1mon_data.send_modify(|vec| *vec = ema_1mon_data); }
|
|
||||||
|
|
||||||
// // tx_tema30_1m_data.send_modify(|vec| *vec = tema_1m_data);
|
|
||||||
// // tx_tema30_30m_data.send_modify(|vec| *vec = tema_30m_data);
|
|
||||||
// // tx_tema30_1d_data.send_modify(|vec| *vec = tema_1d_data);
|
|
||||||
// // tx_tema30_1w_data.send_modify(|vec| *vec = tema_1w_data);
|
|
||||||
// // tx_tema30_1mon_data.send_modify(|vec| *vec = tema_1mon_data);
|
|
||||||
|
|
||||||
// if rsi_1m_result.is_ok() {
|
|
||||||
// tx_rsi30_1m_data.send_modify(|vec| *vec = rsi_1m_data);
|
|
||||||
// }
|
|
||||||
// if rsi_30m_result.is_ok() {
|
|
||||||
// tx_rsi30_30m_data.send_modify(|vec| *vec = rsi_30m_data);
|
|
||||||
// }
|
|
||||||
// if rsi_1d_result.is_ok() {
|
|
||||||
// tx_rsi30_1d_data.send_modify(|vec| *vec = rsi_1d_data);
|
|
||||||
// }
|
|
||||||
// // if rsi_1w_result.is_ok() { tx_rsi30_1w_data.send_modify(|vec| *vec = rsi_1w_data); }
|
|
||||||
// // if rsi_1mon_result.is_ok() { tx_rsi30_1mon_data.send_modify(|vec| *vec = rsi_1mon_data); }
|
|
||||||
|
|
||||||
// if bb_1m_result.is_ok() {
|
|
||||||
// tx_bb30_1m_data.send_modify(|vec| *vec = bb30_1m_data);
|
|
||||||
// }
|
|
||||||
// if bb_30m_result.is_ok() {
|
|
||||||
// tx_bb30_30m_data.send_modify(|vec| *vec = bb30_30m_data);
|
|
||||||
// }
|
|
||||||
// if bb_1d_result.is_ok() {
|
|
||||||
// tx_bb30_1d_data.send_modify(|vec| *vec = bb30_1d_data);
|
|
||||||
// }
|
|
||||||
// // if bb_1w_result.is_ok() { tx_bb30_1w_data.send_modify(|vec| *vec = bb30_1w_data); }
|
|
||||||
// // if bb_1mon_result.is_ok() { tx_bb30_1mon_data.send_modify(|vec| *vec = bb30_1mon_data); }
|
|
||||||
|
|
||||||
// tx_task11
|
|
||||||
// .send(11)
|
|
||||||
// .expect("The mpsc channel has been closed.");
|
|
||||||
// }
|
|
||||||
// _ => {}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // sleep as much as the loop recurs per 1 second if all operation finished within 1 second.
|
|
||||||
// elapsed_time = instant.elapsed().as_millis();
|
|
||||||
// if 1_000 > elapsed_time {
|
|
||||||
// sleep(Duration::from_millis((1_000 - elapsed_time) as u64)).await;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// Task#12: monitoring total market cap
|
// Task#12: monitoring total market cap
|
||||||
if RUNNING_MODE == REAL || RUNNING_MODE == SIMUL || RUNNING_MODE == TEST {
|
if RUNNING_MODE == REAL || RUNNING_MODE == SIMUL || RUNNING_MODE == TEST {
|
||||||
tokio::task::spawn(async move {
|
tokio::task::spawn(async move {
|
||||||
|
|
@ -1783,80 +1182,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
// all_data.rt_price_1w_vec = rx3_rt_price_1w_vec.borrow().clone();
|
// all_data.rt_price_1w_vec = rx3_rt_price_1w_vec.borrow().clone();
|
||||||
// all_data.rt_price_1mon_vec = rx3_rt_price_1mon_vec.borrow().clone();
|
// all_data.rt_price_1mon_vec = rx3_rt_price_1mon_vec.borrow().clone();
|
||||||
|
|
||||||
// SMA data
|
|
||||||
// all_data.sma3_1m_data = rx2_sma3_1m_data.borrow().clone();
|
|
||||||
// all_data.sma3_30m_data = rx2_sma3_30m_data.borrow().clone();
|
|
||||||
// all_data.sma3_1d_data = rx2_sma3_1d_data.borrow().clone();
|
|
||||||
// all_data.sma3_1w_data = rx2_sma3_1w_data.borrow().clone();
|
|
||||||
// all_data.sma3_1mon_data = rx2_sma3_1mon_data.borrow().clone();
|
|
||||||
// all_data.sma10_1m_data = rx2_sma10_1m_data.borrow().clone();
|
|
||||||
// all_data.sma10_30m_data = rx2_sma10_30m_data.borrow().clone();
|
|
||||||
// all_data.sma10_1d_data = rx2_sma10_1d_data.borrow().clone();
|
|
||||||
// all_data.sma10_1w_data = rx2_sma10_1w_data.borrow().clone();
|
|
||||||
// all_data.sma10_1mon_data = rx2_sma10_1mon_data.borrow().clone();
|
|
||||||
// all_data.sma30_1m_data = rx2_sma30_1m_data.borrow().clone();
|
|
||||||
// all_data.sma30_30m_data = rx2_sma30_30m_data.borrow().clone();
|
|
||||||
// all_data.sma30_1d_data = rx2_sma30_1d_data.borrow().clone();
|
|
||||||
// all_data.sma30_1w_data = rx2_sma30_1w_data.borrow().clone();
|
|
||||||
// all_data.sma30_1mon_data = rx2_sma30_1mon_data.borrow().clone();
|
|
||||||
|
|
||||||
// EMA data
|
|
||||||
// all_data.ema3_1m_data = rx2_ema3_1m_data.borrow().clone();
|
|
||||||
// all_data.ema3_30m_data = rx2_ema3_30m_data.borrow().clone();
|
|
||||||
// all_data.ema3_1d_data = rx2_ema3_1d_data.borrow().clone();
|
|
||||||
// all_data.ema3_1w_data = rx2_ema3_1w_data.borrow().clone();
|
|
||||||
// all_data.ema3_1mon_data = rx2_ema3_1mon_data.borrow().clone();
|
|
||||||
// all_data.ema10_1m_data = rx2_ema10_1m_data.borrow().clone();
|
|
||||||
// all_data.ema10_30m_data = rx2_ema10_30m_data.borrow().clone();
|
|
||||||
// all_data.ema10_1d_data = rx2_ema10_1d_data.borrow().clone();
|
|
||||||
// all_data.ema10_1w_data = rx2_ema10_1w_data.borrow().clone();
|
|
||||||
// all_data.ema10_1mon_data = rx2_ema10_1mon_data.borrow().clone();
|
|
||||||
// all_data.ema30_1m_data = rx2_ema30_1m_data.borrow().clone();
|
|
||||||
// all_data.ema30_30m_data = rx2_ema30_30m_data.borrow().clone();
|
|
||||||
// all_data.ema30_1d_data = rx2_ema30_1d_data.borrow().clone();
|
|
||||||
// all_data.ema30_1w_data = rx2_ema30_1w_data.borrow().clone();
|
|
||||||
// all_data.ema30_1mon_data = rx2_ema30_1mon_data.borrow().clone();
|
|
||||||
|
|
||||||
// RSI data
|
|
||||||
// all_data.rsi3_1m_data = rx_rsi3_1m_data.borrow().clone();
|
|
||||||
// all_data.rsi3_30m_data = rx_rsi3_30m_data.borrow().clone();
|
|
||||||
// all_data.rsi3_1d_data = rx_rsi3_1d_data.borrow().clone();
|
|
||||||
// all_data.rsi3_1w_data = rx_rsi3_1w_data.borrow().clone();
|
|
||||||
// all_data.rsi3_1mon_data = rx_rsi3_1mon_data.borrow().clone();
|
|
||||||
// all_data.rsi10_1m_data = rx_rsi10_1m_data.borrow().clone();
|
|
||||||
// all_data.rsi10_30m_data = rx_rsi10_30m_data.borrow().clone();
|
|
||||||
// all_data.rsi10_1d_data = rx_rsi10_1d_data.borrow().clone();
|
|
||||||
// all_data.rsi10_1w_data = rx_rsi10_1w_data.borrow().clone();
|
|
||||||
// all_data.rsi10_1mon_data = rx_rsi10_1mon_data.borrow().clone();
|
|
||||||
// all_data.rsi30_1m_data = rx_rsi30_1m_data.borrow().clone();
|
|
||||||
// all_data.rsi30_30m_data = rx_rsi30_30m_data.borrow().clone();
|
|
||||||
// all_data.rsi30_1d_data = rx_rsi30_1d_data.borrow().clone();
|
|
||||||
// all_data.rsi30_1w_data = rx_rsi30_1w_data.borrow().clone();
|
|
||||||
// all_data.rsi30_1mon_data = rx_rsi30_1mon_data.borrow().clone();
|
|
||||||
|
|
||||||
// Stoch RSI data
|
|
||||||
// all_data.stoch_rsi3_1m_3_k_data = rx_stoch_rsi3_1m_3_k_data.borrow().clone();
|
|
||||||
// all_data.stoch_rsi3_1m_3_d_data = rx_stoch_rsi3_1m_3_d_data.borrow().clone();
|
|
||||||
// all_data.stoch_rsi30_1m_30_k_data = rx_stoch_rsi30_1m_30_k_data.borrow().clone();
|
|
||||||
// all_data.stoch_rsi30_1m_30_d_data = rx_stoch_rsi30_1m_30_d_data.borrow().clone();
|
|
||||||
|
|
||||||
// BollingerBand data
|
|
||||||
// all_data.bb3_1m_data = rx_bb3_1m_data.borrow().clone();
|
|
||||||
// all_data.bb3_30m_data = rx_bb3_30m_data.borrow().clone();
|
|
||||||
// all_data.bb3_1d_data = rx_bb3_1d_data.borrow().clone();
|
|
||||||
// all_data.bb3_1w_data = rx_bb3_1w_data.borrow().clone();
|
|
||||||
// all_data.bb3_1mon_data = rx_bb3_1mon_data.borrow().clone();
|
|
||||||
// all_data.bb10_1m_data = rx_bb10_1m_data.borrow().clone();
|
|
||||||
// all_data.bb10_30m_data = rx_bb10_30m_data.borrow().clone(); to be deleted
|
|
||||||
// all_data.bb10_1d_data = rx_bb10_1d_data.borrow().clone();
|
|
||||||
// all_data.bb10_1w_data = rx_bb10_1w_data.borrow().clone();
|
|
||||||
// all_data.bb10_1mon_data = rx_bb10_1mon_data.borrow().clone();
|
|
||||||
// all_data.bb30_1m_data = rx_bb30_1m_data.borrow().clone();
|
|
||||||
// all_data.bb30_30m_data = rx_bb30_30m_data.borrow().clone();
|
|
||||||
// all_data.bb30_1d_data = rx_bb30_1d_data.borrow().clone();
|
|
||||||
// all_data.bb30_1w_data = rx_bb30_1w_data.borrow().clone();
|
|
||||||
// all_data.bb30_1mon_data = rx_bb30_1mon_data.borrow().clone();
|
|
||||||
|
|
||||||
let result = coex::strategy_team::execute_strategists(&all_data).await;
|
let result = coex::strategy_team::execute_strategists(&all_data).await;
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
|
|
@ -1891,75 +1216,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
all_data.rt_price_1d_vec = rx3_rt_price_1d_vec.borrow().clone();
|
all_data.rt_price_1d_vec = rx3_rt_price_1d_vec.borrow().clone();
|
||||||
all_data.rt_price_1w_vec = rx3_rt_price_1w_vec.borrow().clone();
|
all_data.rt_price_1w_vec = rx3_rt_price_1w_vec.borrow().clone();
|
||||||
all_data.rt_price_1mon_vec = rx3_rt_price_1mon_vec.borrow().clone();
|
all_data.rt_price_1mon_vec = rx3_rt_price_1mon_vec.borrow().clone();
|
||||||
// SMA data
|
|
||||||
// all_data.sma3_1m_data = rx2_sma3_1m_data.borrow().clone();
|
|
||||||
// all_data.sma3_30m_data = rx2_sma3_30m_data.borrow().clone();
|
|
||||||
// all_data.sma3_1d_data = rx2_sma3_1d_data.borrow().clone();
|
|
||||||
// all_data.sma3_1w_data = rx2_sma3_1w_data.borrow().clone();
|
|
||||||
// all_data.sma3_1mon_data = rx2_sma3_1mon_data.borrow().clone();
|
|
||||||
// all_data.sma10_1m_data = rx2_sma10_1m_data.borrow().clone();
|
|
||||||
// all_data.sma10_30m_data = rx2_sma10_30m_data.borrow().clone();
|
|
||||||
// all_data.sma10_1d_data = rx2_sma10_1d_data.borrow().clone();
|
|
||||||
// all_data.sma10_1w_data = rx2_sma10_1w_data.borrow().clone();
|
|
||||||
// all_data.sma10_1mon_data = rx2_sma10_1mon_data.borrow().clone();
|
|
||||||
// all_data.sma30_1m_data = rx2_sma30_1m_data.borrow().clone();
|
|
||||||
// all_data.sma30_30m_data = rx2_sma30_30m_data.borrow().clone();
|
|
||||||
// all_data.sma30_1d_data = rx2_sma30_1d_data.borrow().clone();
|
|
||||||
// all_data.sma30_1w_data = rx2_sma30_1w_data.borrow().clone();
|
|
||||||
// all_data.sma30_1mon_data = rx2_sma30_1mon_data.borrow().clone();
|
|
||||||
// EMA data
|
|
||||||
// all_data.ema3_1m_data = rx2_ema3_1m_data.borrow().clone();
|
|
||||||
// all_data.ema3_30m_data = rx2_ema3_30m_data.borrow().clone();
|
|
||||||
// all_data.ema3_1d_data = rx2_ema3_1d_data.borrow().clone();
|
|
||||||
// all_data.ema3_1w_data = rx2_ema3_1w_data.borrow().clone();
|
|
||||||
// all_data.ema3_1mon_data = rx2_ema3_1mon_data.borrow().clone();
|
|
||||||
// all_data.ema10_1m_data = rx2_ema10_1m_data.borrow().clone();
|
|
||||||
// all_data.ema10_30m_data = rx2_ema10_30m_data.borrow().clone();
|
|
||||||
// all_data.ema10_1d_data = rx2_ema10_1d_data.borrow().clone();
|
|
||||||
// all_data.ema10_1w_data = rx2_ema10_1w_data.borrow().clone();
|
|
||||||
// all_data.ema10_1mon_data = rx2_ema10_1mon_data.borrow().clone();
|
|
||||||
// all_data.ema30_1m_data = rx2_ema30_1m_data.borrow().clone();
|
|
||||||
// all_data.ema30_30m_data = rx2_ema30_30m_data.borrow().clone();
|
|
||||||
// all_data.ema30_1d_data = rx2_ema30_1d_data.borrow().clone();
|
|
||||||
// all_data.ema30_1w_data = rx2_ema30_1w_data.borrow().clone();
|
|
||||||
// all_data.ema30_1mon_data = rx2_ema30_1mon_data.borrow().clone();
|
|
||||||
// RSI data
|
|
||||||
// all_data.rsi3_1m_data = rx_rsi3_1m_data.borrow().clone();
|
|
||||||
// all_data.rsi3_30m_data = rx_rsi3_30m_data.borrow().clone();
|
|
||||||
// all_data.rsi3_1d_data = rx_rsi3_1d_data.borrow().clone();
|
|
||||||
// all_data.rsi3_1w_data = rx_rsi3_1w_data.borrow().clone();
|
|
||||||
// all_data.rsi3_1mon_data = rx_rsi3_1mon_data.borrow().clone();
|
|
||||||
// all_data.rsi10_1m_data = rx_rsi10_1m_data.borrow().clone();
|
|
||||||
// all_data.rsi10_30m_data = rx_rsi10_30m_data.borrow().clone();
|
|
||||||
// all_data.rsi10_1d_data = rx_rsi10_1d_data.borrow().clone();
|
|
||||||
// all_data.rsi10_1w_data = rx_rsi10_1w_data.borrow().clone();
|
|
||||||
// all_data.rsi10_1mon_data = rx_rsi10_1mon_data.borrow().clone();
|
|
||||||
// all_data.rsi30_1m_data = rx_rsi30_1m_data.borrow().clone();
|
|
||||||
// all_data.rsi30_30m_data = rx_rsi30_30m_data.borrow().clone();
|
|
||||||
// all_data.rsi30_1d_data = rx_rsi30_1d_data.borrow().clone();
|
|
||||||
// all_data.rsi30_1w_data = rx_rsi30_1w_data.borrow().clone();
|
|
||||||
// all_data.rsi30_1mon_data = rx_rsi30_1mon_data.borrow().clone();
|
|
||||||
// Stoch RSI data
|
|
||||||
// all_data.stoch_rsi3_1m_3_k_data = rx_stoch_rsi3_1m_3_k_data.borrow().clone();
|
|
||||||
// all_data.stoch_rsi3_1m_3_d_data = rx_stoch_rsi3_1m_3_d_data.borrow().clone();
|
|
||||||
// all_data.stoch_rsi30_1m_30_k_data = rx_stoch_rsi30_1m_30_k_data.borrow().clone();
|
|
||||||
// all_data.stoch_rsi30_1m_30_d_data = rx_stoch_rsi30_1m_30_d_data.borrow().clone();
|
|
||||||
// BollingerBand data
|
|
||||||
// all_data.bb3_1m_data = rx_bb3_1m_data.borrow().clone();
|
|
||||||
// all_data.bb3_30m_data = rx_bb3_30m_data.borrow().clone();
|
|
||||||
// all_data.bb3_1d_data = rx_bb3_1d_data.borrow().clone();
|
|
||||||
// all_data.bb3_1w_data = rx_bb3_1w_data.borrow().clone();
|
|
||||||
// all_data.bb3_1mon_data = rx_bb3_1mon_data.borrow().clone();
|
|
||||||
// all_data.bb10_1m_data = rx_bb10_1m_data.borrow().clone();
|
|
||||||
// all_data.bb10_30m_data = rx_bb10_30m_data.borrow().clone(); to be deleted
|
|
||||||
// all_data.bb10_1d_data = rx_bb10_1d_data.borrow().clone();
|
|
||||||
// all_data.bb10_1w_data = rx_bb10_1w_data.borrow().clone();
|
|
||||||
// all_data.bb10_1mon_data = rx_bb10_1mon_data.borrow().clone();
|
|
||||||
// all_data.bb30_1m_data = rx_bb30_1m_data.borrow().clone();
|
|
||||||
// all_data.bb30_30m_data = rx_bb30_30m_data.borrow().clone();
|
|
||||||
// all_data.bb30_1d_data = rx_bb30_1d_data.borrow().clone();
|
|
||||||
// all_data.bb30_1w_data = rx_bb30_1w_data.borrow().clone();
|
|
||||||
// all_data.bb30_1mon_data = rx_bb30_1mon_data.borrow().clone();
|
|
||||||
|
|
||||||
// let result = coex::strategy_team::execute_strategist_for_test(&all_data).await;
|
// let result = coex::strategy_team::execute_strategist_for_test(&all_data).await;
|
||||||
|
|
||||||
|
|
@ -2019,12 +1275,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut elapsed_time = 0;
|
let mut elapsed_time = 0;
|
||||||
loop {
|
loop {
|
||||||
let instant = Instant::now();
|
let instant = Instant::now();
|
||||||
let coin_price_vec = rx4_price_vec.borrow().clone();
|
|
||||||
let exchange_info_vec = rx_exchange_info_data.borrow().clone();
|
let exchange_info_vec = rx_exchange_info_data.borrow().clone();
|
||||||
let trade_fee_vec = rx_tradefee_vec.borrow().clone();
|
let trade_fee_vec = rx_tradefee_vec.borrow().clone();
|
||||||
let result = coex::exchange_team::buy_coin(
|
let result = coex::exchange_team::buy_coin(
|
||||||
&client,
|
&client,
|
||||||
&coin_price_vec,
|
|
||||||
&exchange_info_vec,
|
&exchange_info_vec,
|
||||||
&trade_fee_vec,
|
&trade_fee_vec,
|
||||||
)
|
)
|
||||||
|
|
@ -2057,13 +1311,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut elapsed_time = 0;
|
let mut elapsed_time = 0;
|
||||||
|
|
||||||
let instant = Instant::now();
|
let instant = Instant::now();
|
||||||
let coin_price_vec = rx4_price_vec.borrow().clone();
|
|
||||||
let exchange_info_vec = rx_exchange_info_data.borrow().clone();
|
let exchange_info_vec = rx_exchange_info_data.borrow().clone();
|
||||||
let trade_fee_vec = rx_tradefee_vec.borrow().clone();
|
let trade_fee_vec = rx_tradefee_vec.borrow().clone();
|
||||||
// let result = coex::exchange_team::buy_coin_for_test(&client, &coin_price_vec, &exchange_info_vec, &trade_fee_vec).await;
|
// let result = coex::exchange_team::buy_coin_for_test(&client, &coin_price_vec, &exchange_info_vec, &trade_fee_vec).await;
|
||||||
let result = coex::exchange_team::buy_coin(
|
let result = coex::exchange_team::buy_coin(
|
||||||
&client,
|
&client,
|
||||||
&coin_price_vec,
|
|
||||||
&exchange_info_vec,
|
&exchange_info_vec,
|
||||||
&trade_fee_vec,
|
&trade_fee_vec,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user