abs in delta calculation

This commit is contained in:
Giulio De Pasquale 2021-01-24 14:29:12 +00:00
parent 61cd795cc2
commit 5646b1d5f4

View File

@ -238,7 +238,7 @@ impl OrderStrategy for FastOrderStrategy {
.current_form .current_form
.price() .price()
.ok_or("The active order does not have a price!")?; .ok_or("The active order does not have a price!")?;
let delta = (1.0 - (offer_comparison / order_price)) * 100.0; let delta = (1.0 - (offer_comparison / order_price).abs()) * 100.0;
if delta > self.threshold { if delta > self.threshold {
messages.push(Message::SubmitOrder { messages.push(Message::SubmitOrder {