# Fat-Finger Limit

`D12-F03-A05` · Matching Engines and Venue Logic → Order Controls · archetype `record-transform` · difficulty 2/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/matching-engines-and-venue-logic/order-controls/fat-finger-limit/
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 { fatFingerLimit } from "fintech-algorithms/matching-engines-and-venue-logic/order-controls/fat-finger-limit";
```

## Signature

```ts
fatFingerLimit(side, limit_price_atoms, reference_price_atoms, quantity, max_quantity, max_notional_atoms, max_aggressive_deviation_bps)
```

Blocks obviously erroneous orders on quantity, notional and aggressive price deviation. The last automated check between a mistyped order and a market-wide incident.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `side` | `"buy" \| "sell"` | yes | Order side. |
| `limit_price_atoms` | `number` | yes | Limit price in atoms. · min: 0, integer: true |
| `reference_price_atoms` | `number` | yes | Reference price the deviation is measured against. · min: 0, integer: true |
| `quantity` | `number` | yes | Order quantity. · min: 0, integer: true |
| `max_quantity` | `number` | yes | Maximum permitted quantity. · min: 0, integer: true |
| `max_notional_atoms` | `number` | yes | Maximum permitted notional in atoms. · min: 0, integer: true |
| `max_aggressive_deviation_bps` | `number` | yes | Maximum permitted aggressive deviation from the reference, in basis points. · min: 0, integer: true |

## Returns

`{ valid, breached_checks, quantity, notional, deviation_bps }`

Which specific checks failed rather than a bare rejection — a participant cannot correct what they are not told.

## Errors

- When a limit is negative — throws

## Complexity

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

## 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

`side`:

```json
"buy"
```

`limit_price_atoms`:

```json
1015000
```

`reference_price_atoms`:

```json
1000000
```

`quantity`:

```json
4000
```

`max_quantity`:

```json
5000
```

`max_notional_atoms`:

```json
5000000000
```

`max_aggressive_deviation_bps`:

```json
200
```

### Call

```ts
fatFingerLimit(side, limit_price_atoms, reference_price_atoms, quantity, max_quantity, max_notional_atoms, max_aggressive_deviation_bps)
```

### Returns

object with 11 fields: side, limit_price_atoms, reference_price_atoms, quantity, order_notional_atoms, aggressive_deviation_bps, checks, violations, …

```json
{
  "side": "buy",
  "limit_price_atoms": 1015000,
  "reference_price_atoms": 1000000,
  "quantity": 4000,
  "order_notional_atoms": 4060000000,
  "aggressive_deviation_bps": 150,
  "checks": {
    "quantity": {
      "value": 4000,
      "limit": 5000,
      "passed": true
    },
    "notional": {
      "value": 4060000000,
      "limit": 5000000000,
      "passed": true
    },
    "aggressive_deviation_bps": {
      "value": 150,
      "limit": 200,
      "passed": true
    }
  },
  "violations": [],
  "valid": true,
  "reason": "within-configured-limits",
  "state": "accepted"
}
```

## Other exports

`tickSizeValidation`, `priceBandValidation`, `selfTradePrevention`, `cancelOnDisconnect`, `circuitBreakerTrigger`, `calculate`. 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.

## 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/matching-engines-and-venue-logic/order-controls/fat-finger-limit/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/matching-engines-and-venue-logic/order-controls/fat-finger-limit/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/matching-engines-and-venue-logic/llms.txt
