Validate per-market minimum share size on order entry and previews

This commit is contained in:
2026-12-03 06:06:20 +08:00
parent 2306c6fd96
commit a7e31fa2ef
13 changed files with 222 additions and 4 deletions
+7 -1
View File
@@ -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);
}