Module Trading_engine.Instrument_lifecycle

Deterministic mutable-listing state keyed by stable instrument identity.

type terminal_policy =
  1. | Hold
  2. | Cash_out of {
    1. price : Scalar.Price.t;
    2. currency : string;
    }
type kind =
  1. | Halt of {
    1. reason : string;
    }
  2. | Resume
  3. | Identifier_change of {
    1. symbol : string;
    2. provider : string;
    3. provider_instrument_id : string;
    }
  4. | Expiration of {
    1. terminal_policy : terminal_policy;
    }
  5. | Delisting of {
    1. terminal_policy : terminal_policy;
    2. reason : string;
    }
type event = private {
  1. id : Id.Corporate_action.t;
  2. instrument_id : Id.Instrument.t;
  3. kind : kind;
}
type status =
  1. | Tradable
  2. | Halted
  3. | Expired
  4. | Delisted
type listing = private {
  1. instrument_id : Id.Instrument.t;
  2. symbol : string;
  3. provider_mappings : (string * string) list;
  4. status : status;
}
type t
val create_event : id:Id.Corporate_action.t -> instrument_id:Id.Instrument.t -> kind:kind -> (event, string) Stdlib.result
val compare_event : event -> event -> int
val create : Instrument.t list -> (t, string) Stdlib.result
val listing : t -> Id.Instrument.t -> listing option
val is_tradable : t -> Id.Instrument.t -> bool
val apply : t -> event -> (t, string) Stdlib.result
val status_to_string : status -> string
val kind_to_string : kind -> string