Validate per-market minimum share size on order entry and previews
This commit is contained in:
@@ -73,6 +73,13 @@ impl Request {
|
||||
"invalid outcome or price"
|
||||
);
|
||||
phase(tx, &market, &["continuous"])?;
|
||||
let rate = crate::fees::rate(tx, &market)?;
|
||||
if let Some(minimum) = crate::minimum_size::MinimumSize::load(tx, &market)? {
|
||||
match side {
|
||||
Side::Buy => minimum.check_budget(requested, limit, rate)?,
|
||||
Side::Sell => minimum.check_shares(requested)?,
|
||||
}
|
||||
}
|
||||
let changes = books.changes(tx)?;
|
||||
books.apply(changes);
|
||||
// The hypothetical incoming order follows all resting orders in time priority.
|
||||
@@ -88,7 +95,6 @@ impl Request {
|
||||
}),
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let rate = crate::fees::rate(tx, &market)?;
|
||||
if side == Side::Buy {
|
||||
crate::fees::fit_budget(rate, &mut fills, requested);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user