# Margin Preview

> Advisory preview of the additional margin needed to open `volume` lots of `symbol_id` as a market BUY and as a market SELL, priced at the current bid. Account, group, symbol and access status, holidays and quotes are checked as for a BUY; trading sessions, volume limits, exposure limits, price protection and long-only restrictions on SELL are not, so an order can still be rejected. Pending orders are margin-checked when they trigger, not when placed. `required_margin` is clamped at 0, while `used_margin_after` and `free_margin_after` reflect margin released by hedging.

Source: /trader/api/trading/get-margin-preview

## `GET /accounts/{account_id}/margin-preview`

**Margin Preview**

Advisory preview of the additional margin needed to open `volume` lots of `symbol_id` as a market BUY and as a market SELL, priced at the current bid. Account, group, symbol and access status, holidays and quotes are checked as for a BUY; trading sessions, volume limits, exposure limits, price protection and long-only restrictions on SELL are not, so an order can still be rejected. Pending orders are margin-checked when they trigger, not when placed. `required_margin` is clamped at 0, while `used_margin_after` and `free_margin_after` reflect margin released by hedging.

Tags: `Trading`

#### Path parameters

- `account_id` (string) (required) — Account ID to preview the margin for

#### Query parameters

- `symbol_id` (string) (required) — Symbol to preview an order for
- `volume` (number) (required) — Order volume in lots


### Responses

#### `200` — Margin impact of a BUY and a SELL of the given volume

**Content-Type:** `application/json`

- `account_id` (string) (required)
- `symbol_id` (string) (required)
- `volume` (number) (required) — Order volume in lots
- `currency` (string) (required) — Account currency all margin amounts are expressed in
- `used_margin` (number) (required) — Currently used margin
- `free_margin` (number) (required) — Current free margin
- `buy` (object) (required)
  - `required_margin` (number) (required) — Additional margin the order needs, in the account currency; never negative
  - `used_margin_after` (number) (required) — Total used margin if the order were opened, in the account currency
  - `free_margin_after` (number) (required) — Free margin if the order were opened, in the account currency; negative when the order cannot be covered
  - `sufficient` (boolean) (required) — Whether current free margin covers `required_margin`
- `sell` (any) (required)

#### `400` — Bad request (missing `symbol_id`, invalid `volume`, off quotes, or the account, group or symbol cannot open positions)

**Content-Type:** `application/json`

- `error` (object) (required)
  - `type` (string) (required) — Error type code
  - `message` (string) (required) — Human-readable error message
  - `field` (string) — Field name if error is field-specific

#### `401` — Unauthorized (invalid or missing JWT token)

**Content-Type:** `application/json`



#### `403` — Forbidden (account access denied)

**Content-Type:** `application/json`



#### `404` — Account, account group, symbol or symbol group not found

**Content-Type:** `application/json`



#### `429` — The per-client-IP rate limit for this request's class was exceeded, or the service is at capacity for
distinct clients. Retry after the `Retry-After` interval.


**Content-Type:** `application/json`



#### `500` — Internal server error

**Content-Type:** `application/json`



