# `CCXT.RateLimiter.State`
[🔗](https://github.com/ZenHive/ccxt_client/blob/main/lib/ccxt/rate_limiter/state.ex#L1)

ETS-backed store for rate limit status across exchanges.

Stores the latest `CCXT.RateLimiter.Info` from each exchange response, keyed by
`{exchange_id, api_key | :public}`. This allows consumers to query current
rate limit pressure at any time.

## Architecture

A GenServer owns the ETS table (OTP-idiomatic -- handles restarts cleanly).
The table is `:public` with `read_concurrency: true` so any process can
read without going through the GenServer.

## Usage

    case CCXT.RateLimiter.State.status("binance") do
      %Info{remaining: remaining} -> remaining
      nil -> :unknown
    end

# `all`

```elixir
@spec all(String.t()) :: [CCXT.RateLimiter.Info.t()]
```

Returns all rate limit entries for an exchange.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts the State GenServer.

# `status`

```elixir
@spec status(String.t()) :: CCXT.RateLimiter.Info.t() | nil
```

Returns the latest rate limit info for an exchange's public endpoints.

# `status`

```elixir
@spec status(String.t(), term()) :: CCXT.RateLimiter.Info.t() | nil
```

Returns the latest rate limit info for a specific exchange + credential key.

# `update`

```elixir
@spec update(
  {String.t(), term()},
  CCXT.RateLimiter.Info.t()
) :: :ok
```

Updates the rate limit info for a given key.

Key is `{exchange_id, api_key | :public}`.

---

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