Module Trading_engine.Order_book_event

Causally ordered level-two order-book observations.

type side =
  1. | Bid
  2. | Ask
type level = private {
  1. price : Scalar.Price.t;
  2. quantity : Scalar.Quantity.t;
}
type kind =
  1. | Snapshot of {
    1. bids : level list;
    2. asks : level list;
    }
  2. | Set of {
    1. side : side;
    2. price : Scalar.Price.t;
    3. quantity : Scalar.Quantity.t;
    }
  3. | Delete of {
    1. side : side;
    2. price : Scalar.Price.t;
    }
  4. | Trade of {
    1. price : Scalar.Price.t;
    2. quantity : Scalar.Quantity.t;
    3. aggressor_side : Market_event.aggressor_side;
    }
type t = private {
  1. instrument_id : Id.Instrument.t;
  2. event_at : Ptime.t;
  3. available_at : Ptime.t;
  4. received_at : Ptime.t;
  5. ingest_sequence : int64;
  6. book_sequence : int64;
  7. kind : kind;
}
val level : price:Scalar.Price.t -> quantity:Scalar.Quantity.t -> (level, string) Stdlib.result
val snapshot : instrument_id:Id.Instrument.t -> event_at:Ptime.t -> available_at:Ptime.t -> received_at:Ptime.t -> ingest_sequence:int64 -> book_sequence:int64 -> bids:level list -> asks:level list -> (t, string) Stdlib.result
val set : instrument_id:Id.Instrument.t -> event_at:Ptime.t -> available_at:Ptime.t -> received_at:Ptime.t -> ingest_sequence:int64 -> book_sequence:int64 -> side:side -> price:Scalar.Price.t -> quantity:Scalar.Quantity.t -> (t, string) Stdlib.result
val delete : instrument_id:Id.Instrument.t -> event_at:Ptime.t -> available_at:Ptime.t -> received_at:Ptime.t -> ingest_sequence:int64 -> book_sequence:int64 -> side:side -> price:Scalar.Price.t -> (t, string) Stdlib.result
val trade : instrument_id:Id.Instrument.t -> event_at:Ptime.t -> available_at:Ptime.t -> received_at:Ptime.t -> ingest_sequence:int64 -> book_sequence:int64 -> price:Scalar.Price.t -> quantity:Scalar.Quantity.t -> aggressor_side:Market_event.aggressor_side -> (t, string) Stdlib.result
val compare_replay_order : t -> t -> int
val side_to_string : side -> string
val side_of_string : string -> (side, string) Stdlib.result