pub struct Fill {
pub quantity: Decimal,
pub price: Decimal,
pub taker_order_id: OrderId,
pub maker_order_id: OrderId,
}Expand description
Represents a match between two orders in the book.
A Fill is generated when two orders match and execute against each other. It contains all the information needed to track and report the trade.
§Fields
quantity- The size of this fill (may be partial)price- The price at which the fill occurredtaker_order_id- The order that initiated the match (incoming order)maker_order_id- The resting order that was matched against
§Terminology
- Maker: The passive order already resting in the book
- Taker: The aggressive order that crosses the spread and initiates the trade
§Example
let mut book = OrderBook::new(dec!(0.01)).unwrap();
// Add a resting sell order (maker)
let (maker_id, _) = book.add_limit_order(
OrderSide::Sell,
dec!(100.00),
dec!(10),
).expect("invalid order");
// Add a buy order that crosses (taker)
let (taker_id, fills) = book.add_limit_order(
OrderSide::Buy,
dec!(100.00),
dec!(5),
).expect("invalid order");
// Examine the fill
let fill = &fills[0];
assert_eq!(fill.quantity, dec!(5));
assert_eq!(fill.price, dec!(100.00));
assert_eq!(fill.maker_order_id, maker_id);
assert_eq!(fill.taker_order_id, taker_id);Fields§
§quantity: Decimal§price: Decimal§taker_order_id: OrderId§maker_order_id: OrderIdAuto Trait Implementations§
impl Freeze for Fill
impl RefUnwindSafe for Fill
impl Send for Fill
impl Sync for Fill
impl Unpin for Fill
impl UnsafeUnpin for Fill
impl UnwindSafe for Fill
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more