Validate market tick sizes and encode precise limit order amounts
This commit is contained in:
@@ -74,6 +74,9 @@ pub(crate) fn submit(tx: &Transaction, books: &Books, order: NewOrder) -> Result
|
||||
if let Some(minimum) = crate::minimum_size::MinimumSize::load(tx, &market)? {
|
||||
minimum.check_shares(qty)?;
|
||||
}
|
||||
if let Some(tick) = crate::tick_size::TickSize::load(tx, &market)? {
|
||||
tick.check(price * 10000)?;
|
||||
}
|
||||
let deadline = match tif {
|
||||
TimeInForce::Gtd => {
|
||||
let expiration =
|
||||
@@ -190,6 +193,9 @@ pub(crate) fn market_buy(tx: &Transaction, books: &Books, order: BudgetBuy) -> R
|
||||
if let Some(minimum) = crate::minimum_size::MinimumSize::load(tx, &market)? {
|
||||
minimum.check_budget(amount_cents, max_price, rate)?;
|
||||
}
|
||||
if let Some(tick) = crate::tick_size::TickSize::load(tx, &market)? {
|
||||
tick.check(max_price * 10000)?;
|
||||
}
|
||||
ledger::cash(tx, &account, -amount_cents)?;
|
||||
tx.execute(
|
||||
"INSERT INTO orders(account,market,outcome,side,price,quantity,remaining,status)
|
||||
|
||||
Reference in New Issue
Block a user