betex 0.35.0

Betfair / Prediction Market Exchange
Documentation
//! Book response types.

use super::types::BookOrderState;
use crate::types::{CorrelationId, FillPrice, FillQuantity, OrderId};

/// Synchronous summary for `PlaceOrder` / `PlaceBinaryOrder`.
#[derive(Debug, Clone)]
pub struct PlaceOrderResult {
    pub accepted: bool,
    pub order_id: OrderId,
    pub matched: FillQuantity,
    pub avg_matched_price: Option<FillPrice>,
    pub remaining: FillQuantity,
    pub final_order_state: Option<BookOrderState>,
}

/// Additional response payload from specific book commands.
#[derive(Debug, Clone)]
pub enum CommandResponseKind {
    /// PlaceOrder succeeded with order details.
    PlaceOrder(PlaceOrderResult),
}

/// Response from a book command, including the correlation ID for request tracking.
#[derive(Debug, Clone)]
pub struct CommandResponse {
    pub correlation_id: Option<CorrelationId>,
    /// Additional response data. None for commands that don't return extra info.
    pub kind: Option<CommandResponseKind>,
}