# `CCXT.Credentials`
[🔗](https://github.com/ZenHive/ccxt_client/blob/main/lib/ccxt/credentials.ex#L1)

API credentials for exchange authentication.

Requires `api_key` and `secret` at minimum. Some exchanges also need
`password` (OKX, KuCoin) or `uid`.

Credentials are always passed explicitly — this module never reads
from environment variables or application config.

## Examples

    {:ok, creds} = CCXT.Credentials.new(api_key: "abc", secret: "xyz")

    creds = CCXT.Credentials.new!(api_key: "abc", secret: "xyz", sandbox: true)

# `t`

```elixir
@type t() :: %CCXT.Credentials{
  api_key: String.t(),
  password: String.t() | nil,
  sandbox: boolean(),
  secret: String.t(),
  uid: String.t() | nil
}
```

# `new`

```elixir
@spec new(keyword()) ::
  {:ok, t()}
  | {:error,
     :missing_api_key
     | :missing_secret
     | {:invalid_type, atom()}
     | {:unknown_key, atom()}}
```

Creates credentials from a keyword list.

Returns `{:ok, credentials}` or `{:error, reason}`.

## Examples

    {:ok, creds} = CCXT.Credentials.new(api_key: "abc", secret: "xyz")
    {:error, :missing_api_key} = CCXT.Credentials.new(secret: "xyz")

# `new!`

```elixir
@spec new!(keyword()) :: t()
```

Creates credentials from a keyword list, raising on invalid input.

## Examples

    creds = CCXT.Credentials.new!(api_key: "abc", secret: "xyz")

---

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