fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Ratio-Adjusted Summation Index (RASI)

Install and import#

bash
npm install fintech-algorithms
ts
import { calculate } from "fintech-algorithms/market-breadth-and-internals/mcclellan-family/ratio-adjusted-summation-index-rasi";

Signature#

calculate(records, cutoff)

RASI: the summation index built on the ratio-adjusted oscillator. The variant most practitioners mean when they quote 'the summation index', and the only one whose historical thresholds hold up across eras.

Parameters#

NameTypeNotes
recordsBreadthRecord[]Session records with revision and event-type fields.
cutoffstringPoint-in-time bound. Revisions arriving after the cutoff are ignored rather than applied, so the series is exactly what was computable at that moment. Breadth data is revised routinely, and a cumulative line silently rebuilt from revised inputs is not the line anyone traded.

Returns#

{ status, points, latest_oscillator, latest_index_value, seed_state, … }

The RASI series with its seeding state.

Errors#

  • When records cannot be ordered — reported in reason_codes rather than thrown

Complexity: time O(records), space O(sessions).

Worked example#

verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

Input#

records
[
  {
    "session_date": "2026-01-02",
    "session_sequence": 1,
    "effective_at": "2026-01-02T21:00:00Z",
    "available_at": "2026-01-02T21:20:00Z",
    "revision": 0,
    "event_type": "upsert",
    "source_evidence_state": "ready",
    "venue_id": "SYNTH-X",
    "universe_id": "SYNTH-STABLE-200",
    "methodology_id": "close-vs-comparable-prior-close-v1",
    "calendar_id": "SYNTH-WEEKDAY",
    "volume_unit": "shares",
    "volume_adjustment_basis": "reported-unadjusted",
    "advances": 100
  }
]
cutoff
"2026-04-01T00:00:00Z"

Call#

calculate(records, cutoff)

Returns#

object with 4 fields: status, latest_oscillator, latest_index_value, ignored_future_records

{
  "status": "resolved",
  "latest_oscillator": null,
  "latest_index_value": null,
  "ignored_future_records": 0
}

Other exports#

This module also exports transformRecord, calculateValues. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams#

Ratio-Adjusted Summation Index (RASI) — family transform
Ratio-Adjusted Summation Index (RASI) — worked state

Calculation flow#

Ratio-Adjusted Summation Index (RASI) calculation flow
flowchart TD
    A["Records available at knowledge cutoff"] --> B{"Contiguous, unique, ready evidence?"}
    B -->|No| C["Withhold path and report reason"]
    B -->|Yes| D["Apply Ratio-Adjusted Summation Index (RASI) input transform"]
    D --> E["SMA-19 fast seed and 10% Trend"]
    D --> F["SMA-39 slow seed and 5% Trend"]
    E --> G{"Both states ready?"}
    F --> G
    G -->|No| H["Warm-up diagnostics"]
    G -->|Yes| I["Fast minus slow oscillator"]
    I --> J["Add to declared cumulative state"]
    J --> K["Provenance and current regime"]

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

  • Calculating the McClellan Oscillator — McClellan Financial Publications; Tom McClellan
  • Ratio Adjusted Summation Index — McClellan Financial Publications; Tom McClellan
  • The McClellan Oscillator and Summation Index — McClellan Financial Publications
  • A-D definition — Nasdaq, Inc.
  • Evidence reconciliation

The rest of the McClellan Family family#