Match fractional share lots and preserve order quantities across restart
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user