Module Algostream_risk_management.Exposure

Aggregate portfolio exposures: gross / net / leverage / per-symbol / per-asset-class.

Composes existing helpers from Algostream_domain_portfolio.Portfolio (gross_exposure, net_exposure, net_asset_value, leverage, position_count) and adds the per-symbol / per-asset-class breakdowns that aren't surfaced today.

type per_symbol_entry = {
  1. symbol : string;
  2. market_value : float;
    (*

    signed: long positive, short negative

    *)
  3. pct_of_nav : float;
    (*

    signed fraction of NAV

    *)
}
type t = {
  1. nav : float;
  2. gross_exposure : float;
  3. net_exposure : float;
  4. leverage_ratio : float;
  5. largest_position_pct : float;
  6. n_positions : int;
  7. per_symbol : per_symbol_entry list;
    (*

    sorted desc by |pct_of_nav|

    *)
  8. per_asset_class : (string * float) list;
    (*

    asset_class -> gross exposure; sorted desc

    *)
}
val compute : portfolio:Portfolio.portfolio -> ?asset_class_lookup:(string -> string) -> unit -> t