Match fractional share lots and preserve order quantities across restart

This commit is contained in:
2026-12-03 07:01:24 +08:00
parent 2c4179a64e
commit 064b301ebd
27 changed files with 343 additions and 111 deletions
+2 -2
View File
@@ -42,8 +42,8 @@ impl OrderBook {
}
}
/// Buy whole shares at maker prices. Budget and limit use the instrument's
/// integer tick unit (total cash in ticks and ticks per share respectively).
/// Buy integer lots at maker prices. Express the budget in price ticks
/// multiplied by quantity lots, the same units as price * remaining.
pub fn match_budget_buy(&self, seq: i64, limit: i64, budget: i64) -> Vec<Fill> {
let mut cash = budget;
let mut capacity = i64::MAX;
+2
View File
@@ -10,6 +10,7 @@ pub struct Order {
pub side: Side,
/// Integer price ticks per share, in the same unit throughout this book.
pub price: i64,
/// Number of minimum quantity lots left on the book.
pub remaining: i64,
}
@@ -19,5 +20,6 @@ pub struct Fill {
pub ask: i64,
/// Integer price ticks per share, in the same unit throughout this book.
pub price: i64,
/// Executed lots, using the same scale as Order::remaining.
pub quantity: i64,
}