fixed Display for Stop order. changed field to stop_price for StopLimit

This commit is contained in:
Giulio De Pasquale 2021-02-20 21:00:50 +00:00
parent 35d967e6d9
commit 386137f16e

View File

@ -261,7 +261,7 @@ pub enum OrderKind {
Limit { price: f64 }, Limit { price: f64 },
Market, Market,
Stop { price: f64 }, Stop { price: f64 },
StopLimit { price: f64, limit_price: f64 }, StopLimit { stop_price: f64, limit_price: f64 },
TrailingStop { distance: f64 }, TrailingStop { distance: f64 },
FillOrKill { price: f64 }, FillOrKill { price: f64 },
ImmediateOrCancel { price: f64 }, ImmediateOrCancel { price: f64 },
@ -291,14 +291,14 @@ impl Display for OrderKind {
write!(f, "[{}]", self.as_str()) write!(f, "[{}]", self.as_str())
} }
OrderKind::Stop { price } => { OrderKind::Stop { price } => {
write!(f, "[{} | Price: {:0.5}", self.as_str(), price,) write!(f, "[{} | Price: {:0.5}]", self.as_str(), price,)
} }
OrderKind::StopLimit { price, limit_price } => { OrderKind::StopLimit { stop_price, limit_price } => {
write!( write!(
f, f,
"[{} | Price: {:0.5}, Limit Price: {:0.5}]", "[{} | Stop: {:0.5}, Limit: {:0.5}]",
self.as_str(), self.as_str(),
price, stop_price,
limit_price limit_price
) )
} }
@ -373,7 +373,7 @@ impl OrderForm {
OrderKind::Limit { price, .. } => Some(price), OrderKind::Limit { price, .. } => Some(price),
OrderKind::Market { .. } => None, OrderKind::Market { .. } => None,
OrderKind::Stop { price, .. } => Some(price), OrderKind::Stop { price, .. } => Some(price),
OrderKind::StopLimit { price, .. } => Some(price), OrderKind::StopLimit { stop_price: price, .. } => Some(price),
OrderKind::TrailingStop { .. } => None, OrderKind::TrailingStop { .. } => None,
OrderKind::FillOrKill { price, .. } => Some(price), OrderKind::FillOrKill { price, .. } => Some(price),
OrderKind::ImmediateOrCancel { price, .. } => Some(price), OrderKind::ImmediateOrCancel { price, .. } => Some(price),