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

# Quickstart

> Step-by-step guide to understanding your trading account and completing your first trade.

This guide walks through understanding your trading account and completing your first trade.

<Info>
  This section assumes you have already created and configured your API key.
</Info>

<Steps>
  <Step title="List trading accounts">
    List the trading accounts associated with your organization to get the trading account ID(s) needed for future calls.

    **GET** `/v2/trading/accounts`

    ```json theme={null}
    {
      "data": [
        {
          "enabled": true,
          "id": "1a7df984-c4b4-11ef-ad6b-4e27db456598",
          "name": "Test Trading Account [TRUST]"
        }
      ]
    }
    ```
  </Step>

  <Step title="Check balances or credit">
    <Accordion title="Pre-funded trading — list trading account balances">
      Check the pre-funded balance using your API key and the trading account ID from the previous step.

      **GET** `/v2/trading/accounts/{tradingAccountId}/balance`

      ```json theme={null}
      {
        "data": [
          {
            "balance": {
              "assetType": "USD",
              "currentPrice": "1",
              "currentUSDValue": "989793.79",
              "quantity": "989793.79"
            }
          },
          {
            "balance": {
              "assetType": "BTC",
              "currentPrice": "94404.709262226",
              "currentUSDValue": "755237.67",
              "quantity": "8"
            }
          },
          {
            "balance": {
              "assetType": "SOL",
              "currentPrice": "183.26165178161",
              "currentUSDValue": "916.31",
              "quantity": "5"
            }
          }
        ]
      }
      ```
    </Accordion>

    <Accordion title="Credit limit trading — get credit limit and usage">
      Check the credit limit for the account and any unsettled trades.

      **GET** `/v2/trading/accounts/{tradingAccountId}/credit`

      ```json theme={null}
      {
        "data": {
          "limits": [
            {
              "assetType": "USD",
              "quantity": "1000000"
            }
          ],
          "usage": [
            {
              "assetType": "AAVE",
              "quantity": "50"
            },
            {
              "assetType": "USD",
              "quantity": "100770.01"
            }
          ]
        }
      }
      ```
    </Accordion>
  </Step>

  <Step title="List trading pairs">
    Review available trading pairs for your organization.

    **GET** `/v2/trading/pairs`

    ```json theme={null}
    {
      "data": [
        {
          "description": "Buy AAVE with USD, or Sell AAVE for USD",
          "pair": "AAVE-USD",
          "referenceData": {
            "baseAssetType": "AAVE",
            "baseSizeIncrement": "0.00000001",
            "lastUpdateTime": "2024-07-09T15:57:55.249Z",
            "minimumOrderSize": "0.000000010000000000000002",
            "priceIncrement": "0.0000001",
            "quoteAssetType": "USD",
            "quoteSizeIncrement": "0.01"
          }
        },
        {
          "description": "Buy ATOM with USD, or Sell ATOM for USD",
          "pair": "ATOM-USD",
          "referenceData": {
            "baseAssetType": "ATOM",
            "baseSizeIncrement": "0.0001",
            "lastUpdateTime": "2024-07-09T15:58:40.249Z",
            "minimumOrderSize": "1",
            "priceIncrement": "0.000001",
            "quoteAssetType": "USD",
            "quoteSizeIncrement": "0.001"
          }
        }
      ]
    }
    ```
  </Step>

  <Step title="Request a quote">
    Request a quote with the following parameters:

    | Parameter      | Description                          | Example     |
    | :------------- | :----------------------------------- | :---------- |
    | `tradingPair`  | Pair from the prior call             | `"BTC-USD"` |
    | `quantity`     | Quantity in currency units           | `"1"`       |
    | `currency`     | Currency of quantity                 | `"BTC"`     |
    | `side`         | `"BUY"`, `"SELL"`, or `"TWOWAY"`     | `"BUY"`     |
    | `idempotentId` | Unique per quote to avoid duplicates | UUID        |
    | `accountId`    | Trading account ID                   | UUID        |

    **POST** `/v2/trading/quote`

    ```json theme={null}
    {
      "currency": "BTC",
      "quantity": "1",
      "side": "BUY",
      "tradingPair": "BTC-USD",
      "idempotentId": "01944c42-5ad3-4108-b376-f78cd6ff0394",
      "accountId": "fd80d8fc-d20f-11ef-ab13-d2dbc7cc735e"
    }
    ```

    Response:

    ```json theme={null}
    {
      "data": {
        "offerAmount": {
          "assetType": "USD",
          "quantity": "99551.67"
        },
        "offerPrice": "99551.67",
        "quoteID": "45055f47-1d5c-4444-921c-7208c3e4178e",
        "quoteRequest": {
          "currency": "BTC",
          "quantity": "1",
          "side": "BUY",
          "tradingPair": "BTC-USD"
        },
        "quoteStatus": "OPEN",
        "timestamp": "2025-01-15T19:29:01.870Z",
        "validUntilTime": "2025-01-15T19:29:04.870Z"
      }
    }
    ```
  </Step>

  <Step title="Accept the quote">
    Accept the quote to execute the trade.

    **POST** `/v2/trading/quote/accept`

    ```json theme={null}
    {
      "quoteID": "45055f47-1d5c-4444-921c-7208c3e4178e",
      "side": "BUY",
      "allowedSlippage": "0.001",
      "accountId": "fd80d8fc-d20f-11ef-ab13-d2dbc7cc735e",
      "idempotentId": "01944c42-5ad3-4108-b376-f78cd6ff0394"
    }
    ```

    Response:

    ```json theme={null}
    {
      "data": {
        "quoteID": "45055f47-1d5c-4444-921c-7208c3e4178e",
        "side": "BUY",
        "tradeID": "4ececdba-56c9-4cf2-ae11-9f439c351b43",
        "tradeStatus": "PENDING"
      }
    }
    ```
  </Step>
</Steps>
