Update filtering
This commit is contained in:
parent
89d10e7ab8
commit
a6831d7f3e
|
|
@ -51,15 +51,19 @@ pub async fn list_up_for_buy(
|
||||||
// }
|
// }
|
||||||
// remove_keys(&mut filtered_data, keys_to_remove).await;
|
// remove_keys(&mut filtered_data, keys_to_remove).await;
|
||||||
|
|
||||||
// Wiliams %R < -50.0
|
// Wiliams %R(200) < -50.0
|
||||||
|
// Wiliams %R(30) < -30.0
|
||||||
let mut keys_to_remove: HashSet<String> = HashSet::new();
|
let mut keys_to_remove: HashSet<String> = HashSet::new();
|
||||||
let mut wprs = wiliams_percent_r(200, &alldata.rt_price_30m_vec, &filtered_data).await?;
|
let mut wprs200 = wiliams_percent_r(200, &alldata.rt_price_30m_vec, &filtered_data).await?;
|
||||||
|
let mut wprs30 = wiliams_percent_r(30, &alldata.rt_price_30m_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 {
|
for (symbol, values) in &mut filtered_data {
|
||||||
if let Some(wpr_vec) = wprs.get(symbol) {
|
if let (Some(wpr200_vec), Some(wpr30_vec)) = (wprs200.get(symbol), wprs30.get(symbol)) {
|
||||||
if wpr_vec.len() > 15
|
if wpr200_vec.len() > 15 && wpr30_vec.len() > 15
|
||||||
&& wpr_vec.last().unwrap().close_time > server_epoch
|
&& wpr200_vec.last().unwrap().close_time > server_epoch
|
||||||
&& wpr_vec.last().unwrap().r_value < -50.0
|
&& wpr200_vec.last().unwrap().r_value < -50.0
|
||||||
|
&& wpr30_vec.last().unwrap().close_time > server_epoch
|
||||||
|
&& wpr30_vec.last().unwrap().r_value < -30.0
|
||||||
{
|
{
|
||||||
} else {
|
} else {
|
||||||
keys_to_remove.insert(symbol.clone());
|
keys_to_remove.insert(symbol.clone());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user