# Provider Adjustment-Basis Drift Detector

`D01-F04-A06` · Market Data Engineering → Data Quality · archetype `row-classify` · difficulty 4/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/market-data-engineering/data-quality/provider-adjustment-basis-drift-detector/
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 { detectAdjustmentBasisDrift } from "fintech-algorithms/market-data-engineering/data-quality/provider-adjustment-basis-drift-detector";
```

## Signature

```ts
detectAdjustmentBasisDrift(input)
```

Compares archived provider adjustment factors and isolates unexplained residual drift after newly knowable corporate actions.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `input` | `object` | yes | Topic-specific point-in-time audit contract. |

## Returns

`object`

Structured state, audit rows, diagnostics, and provenance.

## Complexity

Time `O(n log n)`, space `O(n)`.

## Worked example

Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

### Input

`input`:

```json
{
  "provider": "synthetic-provider",
  "dataset": "daily-equity-bars",
  "instrument_id": "SYNTH-ABC",
  "price_field": "close",
  "basis_id": "split-adjusted-v1",
  "baseline_observed_at": "2026-06-12T20:00:00Z",
  "candidate_observed_at": "2026-06-16T20:00:00Z",
  "tolerance_bps": 1,
  "baseline_rows": [
    {
      "date": "2026-06-10",
      "raw_price": 100,
      "adjusted_price": 100
    },
    {
      "date": "2026-06-11",
      "raw_price": 102,
      "adjusted_price": 102
    },
    {
      "date": "2026-06-12",
      "raw_price": 104,
      "adjusted_price": 104
    }
  ],
  "candidate_rows": [
    {
      "date": "2026-06-10",
      "raw_price": 100,
      "adjusted_price": 50
    },
    {
      "date": "2026-06-11",
      "raw_price": 102,
      "adjusted_price": 51
    },
    {
      "date": "2026-06-12",
      "raw_price": 104,
      "adjusted_price": 52.26
    }
  ],
  "actions": [
    {
      "event_id": "SPLIT-2FOR1",
      "effective_date": "2026-06-15",
      "available_at": "2026-06-13T12:00:00Z",
      "status": "confirmed",
      "adjustment_multiplier": 0.5
    }
  ]
}
```

### Call

```ts
detectAdjustmentBasisDrift(input)
```

### Returns

object with 17 fields: provider, dataset, instrument_id, price_field, basis_id, baseline_observed_at, candidate_observed_at, tolerance_bps, …

```json
{
  "provider": "synthetic-provider",
  "dataset": "daily-equity-bars",
  "instrument_id": "SYNTH-ABC",
  "price_field": "close",
  "basis_id": "split-adjusted-v1",
  "baseline_observed_at": "2026-06-12T20:00:00Z",
  "candidate_observed_at": "2026-06-16T20:00:00Z",
  "tolerance_bps": 1,
  "state": "basis-drift",
  "overlap_count": 3,
  "stable_count": 0,
  "expected_restatement_count": 2,
  "drift_count": 1,
  "max_residual_bps": 49.875415
}
```

Showing 14 of 17 fields.

## Verification and provenance

Tier: **verified** (via D).

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-data-engineering/data-quality/provider-adjustment-basis-drift-detector/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/market-data-engineering/data-quality/provider-adjustment-basis-drift-detector/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/market-data-engineering/llms.txt
