This commit is contained in:
Sik Yoon 2024-05-24 17:01:31 +09:00
parent 5937ee9be0
commit 87cde15b37
4 changed files with 22 additions and 22 deletions

View File

@ -21,7 +21,6 @@ use sqlx::FromRow;
use std::collections::HashMap; use std::collections::HashMap;
use tokio::time::*; use tokio::time::*;
use super::{hmac_signature, REAL, SIMUL, TEST, RUNNING_MODE, FUTURES_URL, FUTURES_URL_TEST, API_KEY, API_KEY_TESTNET, FuturesExchangeInfo, PositionCoinList, FuturesTradeFee, EntryCoinInfo, select_listuped_positions}; use super::{hmac_signature, REAL, SIMUL, TEST, RUNNING_MODE, FUTURES_URL, FUTURES_URL_TEST, API_KEY, API_KEY_TESTNET, FuturesExchangeInfo, PositionCoinList, FuturesTradeFee, EntryCoinInfo, select_listuped_positions};
use crate::strategy_team::future_strategy;
pub enum TimeInForce { pub enum TimeInForce {
Gtc, Gtc,

View File

@ -29,30 +29,31 @@ pub async fn list_up_for_buy(
for symbol in &alldata.valid_symbol_vec { for symbol in &alldata.valid_symbol_vec {
filtered_data.insert(symbol.clone(), FilteredDataValue::new()); filtered_data.insert(symbol.clone(), FilteredDataValue::new());
} }
let server_epoch = get_server_epoch().await;
// current Tema(30) < current Tema(60) // current Tema(15) < current Tema(60)
let mut keys_to_remove: HashSet<String> = HashSet::new(); let mut keys_to_remove: HashSet<String> = HashSet::new();
let tema_15 = tema(15, &alldata.rt_price_1m_vec, &filtered_data).await?; 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 tema_60 = tema(60, &alldata.rt_price_1m_vec, &filtered_data).await?;
let server_epoch = get_server_epoch().await; let server_epoch = get_server_epoch().await;
for (symbol, values) in &mut filtered_data {
let mut do_buy = false; let mut do_buy = false;
if let (Some(tema15_vec), Some(tema60_vec)) = (tema_15.get("BTCUSDT"), tema_60.get("BTCUSDT")) { if let (Some(tema15_vec), Some(tema60_vec)) = (tema_15.get(symbol), tema_60.get(symbol)) {
if tema15_vec.len() > 10 if tema15_vec.len() > 10
&& tema60_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 == tema60_vec.last().unwrap().close_time
&& tema15_vec.last().unwrap().close_time > server_epoch && tema15_vec.last().unwrap().close_time > server_epoch
&& tema60_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 { if tema15_vec.last().unwrap().tema_value < tema60_vec.last().unwrap().tema_value {
do_buy = true; do_buy = true;
}
} }
} }
if do_buy == false {
keys_to_remove.insert(symbol.clone());
}
} }
remove_keys(&mut filtered_data, keys_to_remove).await;
if do_buy == false {
return Ok(());
}
// Heatmap volume: filtering close price with Extra High is over the previous candle from 30 previous candles // Heatmap volume: filtering close price with Extra High is over the previous candle from 30 previous candles
let mut keys_to_remove: HashSet<String> = HashSet::new(); let mut keys_to_remove: HashSet<String> = HashSet::new();

View File

@ -8,7 +8,7 @@ pub mod strategy_007;
pub mod strategy_008; pub mod strategy_008;
pub mod strategy_009; pub mod strategy_009;
pub mod strategy_010; pub mod strategy_010;
pub mod future_strategy; pub mod future_strategy_short;
pub mod future_strategy_long; pub mod future_strategy_long;
// pub mod strategy_test; // pub mod strategy_test;
pub mod strategy_manager; pub mod strategy_manager;

View File

@ -44,7 +44,7 @@ pub async fn execute_list_up_for_buy(
// crate::strategy_team::strategy_008::list_up_for_buy(all_data).await; // crate::strategy_team::strategy_008::list_up_for_buy(all_data).await;
// crate::strategy_team::strategy_009::list_up_for_buy(all_data).await; // crate::strategy_team::strategy_009::list_up_for_buy(all_data).await;
crate::strategy_team::future_strategy_long::list_up_for_buy(all_data, &future_exchange_info_map).await; crate::strategy_team::future_strategy_long::list_up_for_buy(all_data, &future_exchange_info_map).await;
crate::strategy_team::future_strategy::list_up_for_buy(all_data, &future_exchange_info_map).await; crate::strategy_team::future_strategy_short::list_up_for_buy(all_data, &future_exchange_info_map).await;
Ok(()) Ok(())
} }
@ -85,7 +85,7 @@ pub async fn execute_list_up_for_sell(
// ) // )
// .await; // .await;
crate::strategy_team::future_strategy_long::list_up_for_sell().await; crate::strategy_team::future_strategy_long::list_up_for_sell().await;
crate::strategy_team::future_strategy::list_up_for_sell().await; crate::strategy_team::future_strategy_short::list_up_for_sell().await;
Ok(()) Ok(())
} }