Update filtering

This commit is contained in:
Sik Yoon 2024-06-01 17:57:32 +09:00
parent 7fbf68ba11
commit 9540191955
2 changed files with 4 additions and 4 deletions

View File

@ -127,10 +127,10 @@ pub async fn list_up_for_buy(
let mut stoploss_percent = ((min_price - values.current_price.to_f64().unwrap()) * 100.0) / values.current_price.to_f64().unwrap(); let mut stoploss_percent = ((min_price - values.current_price.to_f64().unwrap()) * 100.0) / values.current_price.to_f64().unwrap();
stoploss_percent = (stoploss_percent * 100.0).floor() / 100.0; stoploss_percent = (stoploss_percent * 100.0).floor() / 100.0;
values.stoploss = rust_decimal::prelude::FromPrimitive::from_f64(stoploss_percent).unwrap(); values.stoploss = rust_decimal::prelude::FromPrimitive::from_f64(stoploss_percent).unwrap();
let mut target_percent = stoploss_percent.abs() * 1.5; let mut target_percent = stoploss_percent.abs() * 1.25;
target_percent = (target_percent * 100.0).floor() / 100.0; target_percent = (target_percent * 100.0).floor() / 100.0;
values.target_price = rust_decimal::prelude::FromPrimitive::from_f64(target_percent).unwrap(); values.target_price = rust_decimal::prelude::FromPrimitive::from_f64(target_percent).unwrap();
if stoploss_percent < - 0.07 && stoploss_percent > -1.5 { if stoploss_percent < - 0.07 && stoploss_percent > -1.0 {
do_buy = true; do_buy = true;
} }
} }

View File

@ -127,10 +127,10 @@ pub async fn list_up_for_buy(
let mut stoploss_percent = ((values.current_price.to_f64().unwrap() - max_price) * 100.0) / values.current_price.to_f64().unwrap(); let mut stoploss_percent = ((values.current_price.to_f64().unwrap() - max_price) * 100.0) / values.current_price.to_f64().unwrap();
stoploss_percent = (stoploss_percent * 100.0).floor() / 100.0; stoploss_percent = (stoploss_percent * 100.0).floor() / 100.0;
values.stoploss = rust_decimal::prelude::FromPrimitive::from_f64(stoploss_percent).unwrap(); values.stoploss = rust_decimal::prelude::FromPrimitive::from_f64(stoploss_percent).unwrap();
let mut target_percent = stoploss_percent.abs() * 1.5; let mut target_percent = stoploss_percent.abs() * 1.25;
target_percent = (target_percent * 100.0).floor() / 100.0; target_percent = (target_percent * 100.0).floor() / 100.0;
values.target_price = rust_decimal::prelude::FromPrimitive::from_f64(target_percent).unwrap(); values.target_price = rust_decimal::prelude::FromPrimitive::from_f64(target_percent).unwrap();
if stoploss_percent < - 0.07 && stoploss_percent > -1.5 { if stoploss_percent < - 0.07 && stoploss_percent > -1.0 {
do_buy = true; do_buy = true;
} }
} }