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

# Get trading history

> Get closed trades, deposits, and withdrawals, newest first, one page at a time.

## Query parameters

<ParamField query="to" type="number" required>
  Unix timestamp in milliseconds marking the end of the time window. Use Date.now() for the most recent activity.
</ParamField>

<ParamField query="count" type="number" default="3">
  Number of days to look back from the `to` timestamp. Clamped between 1 and 31. Default is 3.
</ParamField>

<ParamField query="before_id" type="string">
  Optional deal ID cursor. Only returns deals with ID less than this value, for client-side deduplication.
</ParamField>

<ParamField query="symbol" type="string">
  Optional trading symbol filter, for example XAUUSD or EURUSD. Omit to return all symbols.
</ParamField>

## Response

`200` Success.

<ResponseField name="deals" type="object[]">
  Array of deals (money or trade), orders from desc

  <Expandable title="properties">
    <ResponseField name="reason" type="enum<string>">
      Available options: `money`
    </ResponseField>

    <ResponseField name="id" type="string" />

    <ResponseField name="time" type="number" />

    <ResponseField name="type" type="string" />

    <ResponseField name="profit" type="number" />

    <ResponseField name="digits" type="number" default="2" />

    <ResponseField name="comment" type="string" />

    <ResponseField name="symbol" type="string" />

    <ResponseField name="logo" type="string" />

    <ResponseField name="friendlyName" type="string" />

    <ResponseField name="delayed" type="boolean" />

    <ResponseField name="sharia" type="boolean" />
  </Expandable>
</ResponseField>

<ResponseField name="nextTo" type="number">
  Cursor for the next page — pass this as `to` in the next request
</ResponseField>

<ResponseField name="hasMore" type="boolean">
  False when the window has reached the account registration date (no more history)
</ResponseField>

## Possible Errors

| Error | Possible cause | What to do |
| - | - | - |
| 400 | Invalid or missing field | Check the request against the schema. |
| 401 | Token missing or expired | Log in again or use the refresh token. |
| 403 | IP not whitelisted, or account restricted | Confirm your IP is whitelisted; otherwise contact Amana. |
| 429 / 5xx | Rate limit, or temporary issue on our side | Retry with backoff; contact support if it persists. |

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://gateway.amana.io/trading/activity?to=<to>' \
    --header 'Authorization: Bearer <token>'
  ```

  ```python Python theme={null}
  import requests

  url = "https://gateway.amana.io/trading/activity?to=<to>"
  headers = {"Authorization": "Bearer <token>"}

  response = requests.request("GET", url, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://gateway.amana.io/trading/activity?to=<to>', {
    method: 'GET',
    headers: {"Authorization": "Bearer <token>"},
  });
  console.log(await response.json());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "deals": [
      {
        "reason": "money",
        "id": "<string>",
        "time": 123.45,
        "type": "<string>",
        "profit": 123.45,
        "digits": 2,
        "comment": "<string>",
        "symbol": "<string>",
        "logo": "<string>",
        "friendlyName": "<string>",
        "delayed": true,
        "sharia": true
      }
    ],
    "nextTo": 123.45,
    "hasMore": true
  }
  ```

  ```json 400 theme={null}
  {
    "error": "<string>",
    "message": "<string>"
  }
  ```

  ```json 401 theme={null}
  {
    "error": "<string>",
    "message": "<string>",
    "details": {}
  }
  ```

  ```json 403 theme={null}
  {
    "error": "<string>",
    "message": "<string>"
  }
  ```

  ```json 429 theme={null}
  {
    "error": "<string>",
    "message": "<string>"
  }
  ```

  ```json 500 theme={null}
  {
    "error": "<string>",
    "message": "<string>"
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.