Match immediate buys against a cash budget and price cap

This commit is contained in:
2026-12-03 04:27:01 +08:00
parent c27bb60fd2
commit 763b46f43e
11 changed files with 244 additions and 9 deletions
+19
View File
@@ -138,6 +138,25 @@ pub(crate) fn apply(tx: &Transaction, books: &Books, command: Command) -> Result
post_only,
},
),
Command::MarketBuy {
market,
outcome,
account,
amount_cents,
max_price,
tif,
} => book::market_buy(
tx,
books,
book::BudgetBuy {
market,
outcome,
account,
amount_cents,
max_price,
tif: tif.unwrap_or(crate::command::TimeInForce::Fak),
},
),
Command::Cancel { order, account } => {
identifier(&account)?;
let qty = book::release(tx, order, &account, book::CancelReason::Cancelled)?;