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
- Header-name matching (primary) — distinctive header strings in the AST
uniquely identify patterns (e.g.,
X-BAPI-*→ Bybit-style headers) - Hash algorithm fallback — sha384/sha512/sha256 in AST identifiers
- Parent inheritance — child exchanges (e.g., binancecoinm) inherit from their parent's pattern
:customfallback — 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", ...}}
Summary
Functions
Classifies the signing pattern for an exchange spec.
Classifies a signing pattern from a raw sign_method AST map.
Returns the parent exchange ID for a child exchange, or nil.
Returns all known parent→child mappings.
Types
@type classification() :: {CCXT.Signing.pattern(), config()}
Functions
@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, %{}}.
@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.
Returns the parent exchange ID for a child exchange, or nil.
Returns all known parent→child mappings.