# MT5 terminal (Terminal routes and batch orders)

> Tickwire API reference, generated from the OpenAPI document the services export. Base URL: https://api.tickwire.io. Replace YOUR_API_KEY and YOUR_ACCOUNT_ID with your own values; use a sandbox key (twsk_…) to experiment.

Source: https://tickwire.io/docs/reference/mt5-terminal/

### GET /mt5/{account_id}/AccountInfo

**GET /mt5/{account_id}/AccountInfo**

Auth: `X-API-Key`

Static account identity and configuration: name, login, server, company,
currency, leverage, type, margin mode (Netting/Hedging/Exchange; always
Hedging on MT4), stop-out configuration and trade permissions.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/AccountInfo' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/AccountInfo",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/AccountInfo");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/AccountSummary

**GET /mt5/{account_id}/AccountSummary**

Auth: `X-API-Key`

Live financial snapshot: balance, credit, floating profit, equity, margin,
free margin, margin level, leverage, currency and account type
(Demo/Contest/Real; `Unknown` if the terminal does not say).

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/AccountSummary' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/AccountSummary",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/AccountSummary");
console.log(result);
tw.close();
```

### POST /mt5/{account_id}/CloseAll

**POST /mt5/{account_id}/CloseAll**

Auth: `X-API-Key`

Close every open position, optionally only `symbol` and/or `magic`
(`magic: 0` means manually opened), and with `deletePending: true` also
delete matching pending orders. Each ticket is its own audited, idempotent
close (`Idempotency-Key` + `#ticket`); the whole reply is replayed for
the same key. `closed` counts tickets now closed (including ones already
gone), `failed` rejections, `unknown` lost replies.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)
- `500, 502` [`backend_error`](https://tickwire.io/docs/errors/backend_error/)

curl:

```bash
curl -sS -X POST 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/CloseAll' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/mt5/YOUR_ACCOUNT_ID/CloseAll",
        idempotency_key="my-request-1",
        reason="why you are doing this",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/mt5/YOUR_ACCOUNT_ID/CloseAll", {
  idempotencyKey: "my-request-1",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/OpenedOrders

**GET /mt5/{account_id}/OpenedOrders**

Auth: `X-API-Key`

All open positions (`kind: position`) and pending orders
(`kind: pending`). Pending rows show their trigger price in `openPrice`,
the current market price on their side in `currentPrice`, and zero
swap/profit.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OpenedOrders' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/OpenedOrders",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/OpenedOrders");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/OrderCalcMargin

**GET /mt5/{account_id}/OrderCalcMargin**

Auth: `X-API-Key`

Margin (account currency) needed to open `volume` lots of `operation`
on `symbol` at `price`. Places nothing.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderCalcMargin' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/OrderCalcMargin",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/OrderCalcMargin");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/OrderCalcProfit

**GET /mt5/{account_id}/OrderCalcProfit**

Auth: `X-API-Key`

Projected P/L (account currency) of `volume` lots from `priceOpen` to
`priceClose`; pending operations count by direction only. Places nothing.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderCalcProfit' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/OrderCalcProfit",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/OrderCalcProfit");
console.log(result);
tw.close();
```

### POST /mt5/{account_id}/OrderClose

**POST /mt5/{account_id}/OrderClose**

Auth: `X-API-Key`

Close a position (`volume` for a partial close; omitted or 0 closes it
all) or delete a pending order: the ticket type decides. `slippage` in
points (default 10). Closing a ticket that is already gone is
`outcome: no_change` with `isEffective: true` and nothing sent, so a
retried close is safe.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)
- `500, 502` [`backend_error`](https://tickwire.io/docs/errors/backend_error/)

curl:

```bash
curl -sS -X POST 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderClose' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/mt5/YOUR_ACCOUNT_ID/OrderClose",
        idempotency_key="my-request-1",
        reason="why you are doing this",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/mt5/YOUR_ACCOUNT_ID/OrderClose", {
  idempotencyKey: "my-request-1",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/OrderHistory

**GET /mt5/{account_id}/OrderHistory**

Auth: `X-API-Key`

Closed deals (executions, not orders) in `[from, to]`, broker server
time, ISO-8601 or YYYY-MM-DD; absent bounds mean all time. Each row carries
`entry` (In/Out/InOut/OutBy) and `position` (the round trip it belongs to).

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderHistory' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/OrderHistory",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/OrderHistory");
console.log(result);
tw.close();
```

### POST /mt5/{account_id}/OrderModify

**POST /mt5/{account_id}/OrderModify**

Auth: `X-API-Key`

Modify a position (`stopLoss`/`takeProfit` only) or a pending order
(also `price`, `stopLimitPrice`, `expiration`). Omitted fields keep
their current value; `0` clears a stop. An unknown ticket is a
`rejected` result with retcode 0 and nothing is sent.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)
- `500, 502` [`backend_error`](https://tickwire.io/docs/errors/backend_error/)

curl:

```bash
curl -sS -X POST 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderModify' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/mt5/YOUR_ACCOUNT_ID/OrderModify",
        idempotency_key="my-request-1",
        reason="why you are doing this",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/mt5/YOUR_ACCOUNT_ID/OrderModify", {
  idempotencyKey: "my-request-1",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
```

### POST /mt5/{account_id}/OrderSend

**POST /mt5/{account_id}/OrderSend**

Auth: `X-API-Key`

Submit a market (Buy/Sell) or pending (*Limit/*Stop/*StopLimit) order.

Body: `symbol`*, `operation`* (case/separator-insensitive), `volume`*,
`price` (pending), `stopLimitPrice` (*StopLimit), `stopLoss`,
`takeProfit`, `slippage` (points, default 10), `expiration` (pending;
absent = good till cancelled), `comment`, `expertId` (magic). Unknown
fields are refused; an unknown symbol is never sent (HTTP 500, reason
`symbol_not_found`). A 200 only
means the terminal answered: read `success`
and `outcome`. Stop-limit orders on MT4 give `not_supported_on_mt4`.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)
- `500, 502` [`backend_error`](https://tickwire.io/docs/errors/backend_error/)

curl:

```bash
curl -sS -X POST 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderSend' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/mt5/YOUR_ACCOUNT_ID/OrderSend",
        idempotency_key="my-request-1",
        reason="why you are doing this",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/mt5/YOUR_ACCOUNT_ID/OrderSend", {
  idempotencyKey: "my-request-1",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/PositionHistory

**GET /mt5/{account_id}/PositionHistory**

Auth: `X-API-Key`

Closed positions closed within `[from, to]`: one row per round trip with
volume-weighted open/close prices, summed profit/swap/commission and
`netProfit`. A position still partly open is not listed.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/PositionHistory' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/PositionHistory",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/PositionHistory");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/PriceHistory

**GET /mt5/{account_id}/PriceHistory**

Auth: `X-API-Key`

OHLC bars for `symbol` and `timeframe` (M1, M5, M15, M30, H1, H4, D1,
W1, MN1 or 5min/1h/1d) in `[from, to]` (broker time). Without `from` the
most recent 50 000 bars are searched. MT5-only timeframes on MT4 give
`not_supported_on_mt4`.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/PriceHistory' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/PriceHistory",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/PriceHistory");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/ServerTimezone

**GET /mt5/{account_id}/ServerTimezone**

Auth: `X-API-Key`

Broker server time and its offset from UTC: `utc = serverTime -
utcOffsetSeconds`. `utcOffsetSource` says where the offset came from
(`terminal` or `estimated` from a live broker clock). If neither is
possible the answer is 503 `broker_offset_unknown`, never a guess.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/ServerTimezone' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/ServerTimezone",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/ServerTimezone");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/SymbolInfo

**GET /mt5/{account_id}/SymbolInfo**

Auth: `X-API-Key`

Contract specification for `symbol`: digits, point, spread, contract
size, tick size/value, volume limits, trade mode, swaps, currencies, plus
the current bid/ask.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/SymbolInfo' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/SymbolInfo",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/SymbolInfo");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/getQuote

**GET /mt5/{account_id}/getQuote**

Auth: `X-API-Key`

Latest tick for `symbol`: bid, ask, last, volume and broker time.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/getQuote' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/getQuote",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/getQuote");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/healthz

**GET /mt5/{account_id}/healthz**

Auth: `X-API-Key`

Readiness check: 200 once the terminal is `ready`, otherwise 503. The
body holds no personal data: `{status, terminal, broker, account}`.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/healthz' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/healthz",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/healthz");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/livez

**GET /mt5/{account_id}/livez**

Auth: `X-API-Key`

Liveness check: 200 while the terminal answers (whatever the broker
link), otherwise 503.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/livez' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/livez",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/livez");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/status

**GET /mt5/{account_id}/status**

Auth: `X-API-Key`

Connection health in one call, always HTTP 200: `ready` (connected,
logged in, ticks live), `starting` (not ready yet since the terminal
started, within 5 minutes), `degraded` (broker link down or quotes frozen)
or `down` (terminal not answering). `tickwire` carries our full ladder
(healthy/stale/disconnected/down) with reasons and ages.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/status' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/status",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/status");
console.log(result);
tw.close();
```

### GET /mt5/{account_id}/symbols

**GET /mt5/{account_id}/symbols**

Auth: `X-API-Key`

Names of all symbols available on this terminal. Use them verbatim:
brokers suffix symbols (EURUSD.sd, XAUUSDm).

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `503` [`not_connected`](https://tickwire.io/docs/errors/not_connected/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/symbols' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/symbols",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/symbols");
console.log(result);
tw.close();
```
