Module Algostream_strategy.Action

What a strategy emits.

on_event returns actions rather than calling a submit callback. Three things fall out of that choice:

An intent describes what the strategy wants. Turning it into an Order.order on a venue is the engine's job.

type urgency =
  1. | Passive
    (*

    prefer to rest at the touch and earn the maker fee; the fill engine simulates queue position

    *)
  2. | Normal
  3. | Aggressive
    (*

    cross the spread now, accept the taker fee

    *)
type intent = {
  1. symbol : string;
  2. side : Side.t;
  3. quantity : float;
    (*

    must be positive; direction lives in side

    *)
  4. order_type : Order.order_type;
  5. time_in_force : Order.time_in_force;
  6. client_order_id : string;
    (*

    strategy-assigned and strategy-unique; the engine assigns venue ids

    *)
  7. strategy_id : string;
  8. urgency : urgency;
    (*

    advisory to the fill model only — it never silently rewrites order_type

    *)
  9. tag : string;
    (*

    free-form; lands in the blotter row so a fill can be traced to its reason

    *)
}
type t =
  1. | Submit of intent
  2. | Cancel of string
    (*

    client_order_id

    *)
  3. | Replace of {
    1. client_order_id : string;
    2. new_quantity : float option;
    3. new_price : float option;
    }
  4. | Set_timer of {
    1. ts_ns : int64;
    2. tag : string;
    }
  5. | Log of string
val submit : symbol:string -> side:Side.t -> quantity:float -> order_type:Order.order_type -> ?time_in_force:Order.time_in_force -> ?urgency:urgency -> ?tag:string -> client_order_id:string -> strategy_id:string -> unit -> t

Convenience constructor with sensible defaults: Good_till_cancel, Normal urgency, empty tag. Raises Invalid_argument on a non-positive quantity — a zero-size order is always a bug in the caller's sizing, and failing loudly beats a silent no-op.

val urgency_to_string : urgency -> string
val to_string : t -> string