Module Algostream_pairs.Selection

Pair universe enumeration + screening / ranking.

Explicit keeps the candidate pair list under the caller's control. All_pairs_of enumerates the N(N-1)/2 symmetric pairs of a symbol list (lexicographic y < x ordering, mirroring Pair_id.of_symbols).

candidates reads Snapshot.t values (allocated by the Processor and read via Atomic.get) and applies the criteria filter, then sorts by rank descending. The default ranker is a weighted score over (1 − p_value), |corr|, and 1/(1 + half_life) — sensible heuristic; strategies override by computing their own candidate list.

type universe =
  1. | Explicit of (Symbol.t * Symbol.t) list
  2. | All_pairs_of of Symbol.t list
type criteria = {
  1. min_n : int;
  2. min_corr : float;
  3. max_adf_pvalue : float;
  4. min_half_life_bars : float;
  5. max_half_life_bars : float;
  6. max_beta_stdev : float;
  7. min_avg_volume : float;
}
type candidate = {
  1. pair : Pair_id.t;
  2. corr : float;
  3. beta : float;
  4. beta_stdev : float;
  5. adf_t_stat : float;
  6. adf_p_value : float;
  7. half_life : float;
  8. avg_volume : float;
  9. rank : float;
}
val default_criteria : criteria
val enumerate_pairs : universe -> Pair_id.t list
val candidates : Snapshot.t list -> criteria -> candidate list