Limit buy price

This commit is contained in:
Sik Yoon 2024-03-28 23:54:54 +09:00
parent 3193cfac5f
commit e4d19b7d48

View File

@ -131,7 +131,7 @@ pub async fn list_up_for_buy(
}
remove_keys(&mut filtered_data, keys_to_remove).await;
// limit buy price: 2 * abs(이전 5 개 중 최대값 제거 한 opclo 값 평균 - 현재 open 값) + 현재 open 값 > current_price
// limit buy price: 0.5 * abs(이전 5 개 중 최대값 제거 한 opclo 값 평균 - 현재 open 값) + 현재 open 값 > current_price
let mut keys_to_remove: HashSet<String> = HashSet::new();
let server_epoch = get_server_epoch().await;
for (symbol, values) in &mut filtered_data {
@ -154,7 +154,7 @@ pub async fn list_up_for_buy(
let current_price = rt_price_vec.last().unwrap().close_price;
let difference = (mean - rt_price_vec.last().unwrap().open_price).abs();
if current_price < rt_price_vec.last().unwrap().open_price + (2.0 * difference) {
if current_price < rt_price_vec.last().unwrap().open_price + (0.5 * difference) {
} else {
keys_to_remove.insert(symbol.clone());
}