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

# Accounts, positions, and orders

> Query a verified account and traverse paginated results.

All these routes require a token, read permission, and an active verification for
the login. They do not replace querying a request's execution result.

## Account data

`GET /api/v1/accounts/{login}` returns only `retcode` and `answer`.
Within `answer`, only `Login`, `Registration`, `LastAccess`, `Name`, `FirstName`,
`Balance`, and `Credit` are allowed. All other MT5 fields are excluded.

Example successful response:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "retcode": "0 Done",
  "answer": {
    "Login": "104205",
    "Registration": "1765252647",
    "LastAccess": "1790786983",
    "Name": "test edit",
    "FirstName": "test edit",
    "Balance": "258531.44",
    "Credit": "0.00"
  }
}
```

Values and types received from MT5 are preserved. Missing allowed fields are
omitted; values are not invented. `Registration` and `LastAccess` are Unix
timestamps in seconds. This field list applies only to the account query;
errors retain the format described in [Errors](/errors).

## Open positions

`GET /api/v1/accounts/{login}/positions` returns a page of positions.

A successful response contains only `retcode` and an `answer` array.
Each position allows only these fields: `Position`, `Symbol`, `Action`, `TimeCreate`, `PriceOpen`, `PriceCurrent`, `PriceSL`, `PriceTP`, `Volume`, `Profit`, `Storage`.

Additional MT5 fields are excluded. Received values and types are preserved;
missing fields are omitted. With no positions, `answer` is `[]`.
`TimeCreate` and `TimeUpdate` are Unix timestamps in seconds; their `Msc`
variants use milliseconds. Errors retain their usual format.

| Parameter | Default | Limit |
| - | - | - |
| `offset` | `0` | Integer greater than or equal to 0 |
| `total` | `100` | Integer between 1 and 1000 |

Keep the `Position` ticket, owner `Login`, `Symbol`, `Action`, and `Volume`
to prepare a closing order. The ticket is not the ID returned when submitting an order.

`GET /api/v1/accounts/{login}/positions/count` queries the number of open positions.
Its result reflects the time of the query and may change before you read a page.

## Active orders

A successful response contains only `retcode` and an `answer` array.
Each order allows only these fields: `Order`, `Symbol`, `State`, `Type`, `TimeSetup`, `TimeExpiration`, `TypeTime`, `PriceOrder`, `PriceTrigger`, `PriceCurrent`, `PriceSL`, `PriceTP`, `VolumeInitial`, `VolumeCurrent`.

Additional MT5 fields are excluded. Received values and types are preserved;
missing fields are omitted. With no orders, `answer` is `[]`.
Time fields use Unix seconds and `Msc` variants use milliseconds; received
`0` values are preserved. Errors retain their usual format.

`GET /api/v1/accounts/{login}/orders` queries active MT5 orders.
It accepts `offset` from 0 and `total` between 1 and 100, defaulting to 100.
It is not execution history. An executed market order does not necessarily remain
in this list. The portal does not expose order modification or cancellation.

## Traverse all pages

1. Start with `offset=0` and a `total` within the route's limit.
2. Process the `answer` array in the MT5 response.
3. If it contains fewer items than `total`, stop.
4. If the page is full, increase `offset` by `total` and query the next page.
5. Apply a defensive page limit and respect the permitted request frequency.

Pages are not a transactional snapshot. If trades occur concurrently,
reconcile changes by ticket and query again when necessary.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --fail-with-body "$API_BASE/api/v1/accounts/123456" \
  -H "Authorization: Bearer $MT5_API_TOKEN"
curl --fail-with-body "$API_BASE/api/v1/accounts/123456/positions?offset=0&total=1000" \
  -H "Authorization: Bearer $MT5_API_TOKEN"
curl --fail-with-body "$API_BASE/api/v1/accounts/123456/positions/count" \
  -H "Authorization: Bearer $MT5_API_TOKEN"
curl --fail-with-body "$API_BASE/api/v1/accounts/123456/orders?offset=0&total=100" \
  -H "Authorization: Bearer $MT5_API_TOKEN"
```

Do not assume an undocumented history, balance, or execution schema.
