play min profit and good profit sounds when coming from break even as well

This commit is contained in:
Giulio De Pasquale 2021-02-26 16:11:54 +00:00
parent 093269b173
commit 8bd9eb048d

View File

@ -9,7 +9,7 @@ use crate::BoxError;
use crate::events::{ActionMessage, Event, EventKind, EventMetadata};
use crate::managers::OptionUpdate;
use crate::models::{ActiveOrder, OrderBook, OrderForm, OrderKind, OrderMetadata, Position, PositionProfitState, TradingFees};
use crate::models::PositionProfitState::{Critical, Loss};
use crate::models::PositionProfitState::{BreakEven, Critical, Loss};
use crate::sounds::{GOOD_PROFIT_SOUND_PATH, LOSS_TO_BREAK_EVEN_PATH, MIN_PROFIT_SOUND_PATH, play_sound};
/***************
@ -115,6 +115,14 @@ impl TrailingStop {
_ => {}
}
}
if let BreakEven = prev_state {
match current_state {
PositionProfitState::MinimumProfit => { play_sound(MIN_PROFIT_SOUND_PATH); }
PositionProfitState::Profit => { play_sound(GOOD_PROFIT_SOUND_PATH); }
_ => {}
}
}
}
fn print_status(&self, position: &Position) {