# Net Advances

> Count Participation Without Hiding Data Gaps

`D04-F01-A01` · Market Breadth and Internals → Advance/Decline Breadth · archetype `record-transform` · difficulty 1/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/market-breadth-and-internals/advance-decline-breadth/net-advances/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

```ts
import { calculateNetAdvances } from "fintech-algorithms/market-breadth-and-internals/advance-decline-breadth/net-advances";
```

## Signature

```ts
calculateNetAdvances(request)
```

Advances minus declines for a session. The simplest breadth measure and the input to most of the others — its value is that it counts companies rather than weighting them, so it says what *most* of the market did.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `request` | `BreadthRequest` | yes | Carries the session identity (`session_date`, `session_id`, `venue_id`, `universe_id`) plus the rules that decide what counts as an advance: `comparison_basis` (which price is compared against which), `corporate_action_policy`, and `price_tolerance` for unchanged. `calculation_as_of` bounds which revisions are usable. |

## Returns

`{ status, direction, metric, session_date, universe_id, … }`

The count with a `status` and the full identity of what was counted — two systems disagreeing on breadth almost always disagree about the universe, not the arithmetic.

## Errors

- When the comparison basis or corporate-action policy is unrecognised — reported as a status rather than thrown

## Complexity

Time `O(members)`, space `O(1)`.

## Worked example

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

### Input

`request`:

```json
{
  "session_date": "2026-01-05",
  "session_id": "regular",
  "session_timezone": "UTC",
  "venue_id": "SYNTH-X",
  "universe_id": "SYNTH-3",
  "comparison_basis": "comparable-prior-close",
  "corporate_action_policy": "provider-adjusted",
  "price_tolerance": 0,
  "calculation_as_of": "2026-01-05T22:00:00Z",
  "revisions": [
    {
      "revision_id": "R1",
      "revision_sequence": 1,
      "supersedes_revision_id": null,
      "effective_at": "2026-01-05T21:00:00Z",
      "available_at": "2026-01-05T21:05:00Z",
      "is_final": true,
      "members": [
        {
          "listing_id": "L-A",
          "security_id": "S-A",
          "ticker": "A",
          "state": "eligible",
          "current_price": 11,
          "prior_comparable_price": 10
        },
        {
          "listing_id": "L-D",
          "security_id": "S-D",
          "ticker": "D",
          "state": "eligible",
          "current_price": 9,
          "prior_comparable_price": 10
        },
        {
          "listing_id": "L-U",
          "security_id": "S-U",
          "ticker": "U",
          "state": "eligible",
          "current_price": 10,
          "prior_comparable_price": 10
        }
      ]
    }
  ]
}
```

### Call

```ts
calculateNetAdvances(request)
```

### Returns

object with 14 fields: status, direction, selected_revision_id, advances, declines, unchanged, excluded, unclassified, …

```json
{
  "status": "ready",
  "direction": "balanced",
  "selected_revision_id": "R1",
  "advances": 1,
  "declines": 1,
  "unchanged": 1,
  "excluded": 0,
  "unclassified": 0,
  "universe_size": 3,
  "mover_count": 2,
  "classified_count": 3,
  "coverage_ratio": 1,
  "net_advances": 0,
  "is_provisional": false
}
```

## Verification and provenance

Tier: **verified** (via input-expected).

The worked example below is the figure published in this algorithm's article, replayed and asserted by the test suite on every build. The arithmetic cannot drift without the build failing.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.1.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/market-breadth-and-internals/advance-decline-breadth/net-advances/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/market-breadth-and-internals/advance-decline-breadth/net-advances/impl.ts
- Standalone repository: https://github.com/IslamBaraka90/Fintech-Net-Advances-Market-Breadth-algorithm
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/market-breadth-and-internals/llms.txt
