Module Algostream_domain_orders.Order

type order_side =
  1. | Buy
  2. | Sell
type order_type =
  1. | Market
  2. | Limit of Base.float
  3. | Stop of Base.float
  4. | Stop_limit of {
    1. stop_price : Base.float;
    2. limit_price : Base.float;
    }
  5. | Iceberg of {
    1. display_size : Base.float;
    2. total_size : Base.float;
    }
type time_in_force =
  1. | Good_till_cancel
  2. | Immediate_or_cancel
  3. | Fill_or_kill
  4. | Good_till_date of Timestamp.t
type order_status =
  1. | Pending
  2. | Open
  3. | Partially_filled of {
    1. filled_quantity : Base.float;
    }
  4. | Filled
  5. | Cancelled
  6. | Rejected of Base.string
  7. | Expired
type order = {
  1. id : Base.string;
  2. client_order_id : Base.string;
  3. symbol : Base.string;
  4. side : order_side;
  5. order_type : order_type;
  6. quantity : Base.float;
  7. time_in_force : time_in_force;
  8. status : order_status;
  9. created_at : Timestamp.t;
  10. updated_at : Timestamp.t;
  11. filled_quantity : Base.float;
  12. average_fill_price : Base.float Base.option;
  13. commission : Base.float;
  14. exchange : Base.string;
  15. strategy_id : Base.string Base.option;
}
val stamp : Timestamp.t option -> Timestamp.t
val create_order : ?ts:Timestamp.t -> id:Base.string -> client_order_id:Base.string -> symbol:Base.string -> side:order_side -> order_type:order_type -> quantity:Base.float -> time_in_force:time_in_force -> exchange:Base.string -> ?strategy_id:Base.string -> unit -> order
val create_market_order : ?ts:Timestamp.t -> id:Base.string -> client_order_id:Base.string -> symbol:Base.string -> side:order_side -> quantity:Base.float -> exchange:Base.string -> ?strategy_id:Base.string -> unit -> order
val create_limit_order : ?ts:Timestamp.t -> id:Base.string -> client_order_id:Base.string -> symbol:Base.string -> side:order_side -> quantity:Base.float -> price:Base.float -> exchange:Base.string -> ?strategy_id:Base.string -> unit -> order
val remaining_quantity : order -> Base__Float.t
val is_open : order -> bool
val is_filled : order -> bool
val is_pending : order -> bool
val is_cancelled : order -> bool
val is_rejected : order -> bool
val fill_percentage : order -> Base__Float.t
val update_status : ?ts:Timestamp.t -> order -> order_status -> order
val add_fill : ?ts:Timestamp.t -> order -> fill_quantity:Base__Float.t -> fill_price:Base__Float.t -> order
val get_limit_price : order -> Base.float option
val get_stop_price : order -> Base.float option
val order_value : order -> Base__Float.t
val order_side_to_string : order_side -> string
val order_type_to_string : order_type -> string