update filtering
This commit is contained in:
parent
33221f253a
commit
2b08bbfd66
|
|
@ -118,8 +118,8 @@ pub async fn list_up_for_buy(
|
||||||
if let Some(truncated_vec) = realtime_price_vec.get(realtime_price_vec.len()-element_number..) {
|
if let Some(truncated_vec) = realtime_price_vec.get(realtime_price_vec.len()-element_number..) {
|
||||||
let min_price = truncated_vec
|
let min_price = truncated_vec
|
||||||
.iter()
|
.iter()
|
||||||
.min_by(|x, y| x.opclo_price.partial_cmp(&y.opclo_price).unwrap())
|
.min_by(|x, y| x.low_price.partial_cmp(&y.low_price).unwrap())
|
||||||
.unwrap().opclo_price;
|
.unwrap().low_price;
|
||||||
if values.current_price.to_f64().is_some_and(|a| a < min_price) {
|
if values.current_price.to_f64().is_some_and(|a| a < min_price) {
|
||||||
let mut stoploss_percent = ((values.current_price.to_f64().unwrap() - min_price) * 100.0) / values.current_price.to_f64().unwrap();
|
let mut stoploss_percent = ((values.current_price.to_f64().unwrap() - min_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;
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,8 @@ pub async fn list_up_for_buy(
|
||||||
if let Some(truncated_vec) = realtime_price_vec.get(realtime_price_vec.len()-element_number..) {
|
if let Some(truncated_vec) = realtime_price_vec.get(realtime_price_vec.len()-element_number..) {
|
||||||
let max_price = truncated_vec
|
let max_price = truncated_vec
|
||||||
.iter()
|
.iter()
|
||||||
.max_by(|x, y| x.opclo_price.partial_cmp(&y.opclo_price).unwrap())
|
.max_by(|x, y| x.high_price.partial_cmp(&y.high_price).unwrap())
|
||||||
.unwrap().opclo_price;
|
.unwrap().high_price;
|
||||||
if values.current_price.to_f64().is_some_and(|a| a < max_price) {
|
if values.current_price.to_f64().is_some_and(|a| a < max_price) {
|
||||||
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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user