> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hyperoru.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Exchange Setup

> Connect Hyperliquid and Binance Futures accounts

Hyperoru supports trading on Hyperliquid and Binance Futures. This guide covers wallet configuration, testnet environments, and trading mode management.

## Hyperliquid

Hyperliquid is an L1 blockchain optimized for on-chain perpetual trading. Hyperoru supports two wallet types for authentication.

### Wallet types

<Tabs>
  <Tab title="Private Key">
    Direct wallet authentication using the account's private key. This grants full trading permissions.

    ```bash theme={null}
    curl -X POST https://api.production.hyperoru.com/api/hyperliquid/wallets \
      -H "Authorization: Bearer $TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "trader_id": "trader-uuid",
        "wallet_type": "private_key",
        "private_key": "0xYourPrivateKey"
      }'
    ```

    <Warning>
      Private keys are AES-encrypted at rest using `HYPERLIQUID_ENCRYPTION_KEY`. Never share your private key or encryption key.
    </Warning>
  </Tab>

  <Tab title="Agent Key">
    Hyperliquid agent wallets are delegated keys with restricted permissions. They can trade on behalf of the main wallet without having withdrawal access.

    ```bash theme={null}
    curl -X POST https://api.production.hyperoru.com/api/hyperliquid/wallets \
      -H "Authorization: Bearer $TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "trader_id": "trader-uuid",
        "wallet_type": "agent",
        "agent_private_key": "0xAgentKey",
        "agent_address": "0xAgentAddress",
        "vault_address": "0xMainWallet"
      }'
    ```

    <Tip>
      Agent keys are the recommended approach for automated trading. They limit exposure if the key is compromised — the agent can trade but cannot withdraw funds.
    </Tip>
  </Tab>
</Tabs>

### Testnet vs mainnet

Toggle between Hyperliquid testnet and mainnet per trader:

```bash theme={null}
curl -X PUT https://api.production.hyperoru.com/api/hyperliquid/wallets/{wallet_id}/network \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"testnet": true}'
```

| Network | API Base URL                          | Purpose                               |
| ------- | ------------------------------------- | ------------------------------------- |
| Mainnet | `https://api.hyperliquid.xyz`         | Live trading with real funds          |
| Testnet | `https://api.hyperliquid-testnet.xyz` | Paper trading and strategy validation |

## Binance Futures

Binance Futures uses API key + secret authentication with HMAC-SHA256 request signing.

### Setup

```bash theme={null}
curl -X POST https://api.production.hyperoru.com/api/binance/credentials \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "trader_id": "trader-uuid",
    "api_key": "your-binance-api-key",
    "api_secret": "your-binance-api-secret"
  }'
```

### Testnet vs mainnet

```bash theme={null}
curl -X PUT https://api.production.hyperoru.com/api/binance/credentials/{credential_id}/network \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"testnet": true}'
```

| Network | API Base URL                        | Purpose                               |
| ------- | ----------------------------------- | ------------------------------------- |
| Mainnet | `https://fapi.binance.com`          | Live trading with real funds          |
| Testnet | `https://testnet.binancefuture.com` | Paper trading and strategy validation |

<Note>
  Binance testnet API keys are separate from mainnet keys. Create testnet keys at [testnet.binancefuture.com](https://testnet.binancefuture.com).
</Note>

## Trading mode

Each trader has an active trading mode that determines which exchange receives orders:

```bash theme={null}
curl -X PUT https://api.production.hyperoru.com/api/traders/{trader_id}/trading-mode \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode": "hyperliquid"}'
```

| Mode          | Description                     |
| ------------- | ------------------------------- |
| `hyperliquid` | Orders route to Hyperliquid     |
| `binance`     | Orders route to Binance Futures |

<Warning>
  Switching trading mode does not close open positions on the previous exchange. Close positions manually before switching.
</Warning>

## Watchlist management

Each trader maintains a watchlist of symbols to monitor. The watchlist determines which symbols appear in market data context, signal evaluation, and strategy execution.

```bash theme={null}
curl -X PUT https://api.production.hyperoru.com/api/traders/{trader_id}/watchlist \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "symbols": ["BTC", "ETH", "SOL", "ARB", "DOGE"]
  }'
```

### Querying available symbols

```bash theme={null}
curl https://api.production.hyperoru.com/api/crypto/symbols \
  -H "Authorization: Bearer $TOKEN"
```

Returns the full list of tradeable symbols on the active exchange.

## Security best practices

<CardGroup cols={2}>
  <Card title="Use agent keys" icon="key">
    On Hyperliquid, prefer agent keys over direct private keys. Agent keys cannot withdraw funds.
  </Card>

  <Card title="Restrict API permissions" icon="shield">
    On Binance, create API keys with only Futures trading permission. Disable spot, withdrawal, and margin.
  </Card>

  <Card title="IP whitelisting" icon="filter">
    On Binance, restrict API key access to your server's IP address.
  </Card>

  <Card title="Start on testnet" icon="flask-vial">
    Validate strategies on testnet before committing real funds. Both exchanges offer full-featured testnet environments.
  </Card>
</CardGroup>
