Update filtering
This commit is contained in:
parent
7fbf68ba11
commit
9540191955
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user