# `CCXT.Signing.Classifier`
[🔗](https://github.com/ZenHive/ccxt_client/blob/main/lib/ccxt/signing/classifier.ex#L1)

Classifies exchange signing patterns from spec AST data.

Analyzes `structure.sign_method` AST from each exchange spec to determine
which of the 9 signing patterns it uses, plus exchange-specific config
(header names, encoding preferences).

## Classification Strategy

1. **Header-name matching** (primary) — distinctive header strings in the AST
   uniquely identify patterns (e.g., `X-BAPI-*` → Bybit-style headers)
2. **Hash algorithm fallback** — sha384/sha512/sha256 in AST identifiers
3. **Parent inheritance** — child exchanges (e.g., binancecoinm) inherit
   from their parent's pattern
4. **`:custom` fallback** — unclassifiable exchanges get the escape hatch

## Usage

    spec = CCXT.Spec.load!("bybit")
    {pattern, config} = CCXT.Signing.Classifier.classify(spec)
    #=> {:hmac_sha256_headers, %{api_key_header: "X-BAPI-API-KEY", ...}}

# `classification`

```elixir
@type classification() :: {CCXT.Signing.pattern(), config()}
```

# `config`

```elixir
@type config() :: %{optional(atom()) =&gt; term()}
```

# `classify`

```elixir
@spec classify(map()) :: classification()
```

Classifies the signing pattern for an exchange spec.

Returns `{pattern_atom, config_map}` where config contains
exchange-specific header names and encoding preferences.

If the spec has no `sign_method`, falls back to parent inheritance
or returns `{:custom, %{}}`.

# `classify_from_ast`

```elixir
@spec classify_from_ast(map()) :: classification()
```

Classifies a signing pattern from a raw sign_method AST map.

Useful when you have the AST directly without a full spec wrapper.

# `parent_for`

```elixir
@spec parent_for(String.t()) :: String.t() | nil
```

Returns the parent exchange ID for a child exchange, or nil.

# `parent_map`

```elixir
@spec parent_map() :: %{required(String.t()) =&gt; String.t()}
```

Returns all known parent→child mappings.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
