# cTrader Account Data & Status API

> Index of every docs page as Markdown: [llms.txt](https://fxsocket.com/docs/llms.txt). All pages in one file: [llms-full.txt](https://fxsocket.com/llms-full.txt).

Source: https://fxsocket.com/docs/ctrader/account-data

Read live and static state for a linked cTrader account: balance and equity, the account configuration, open positions and pending orders, deal and position history, and a single connection-health endpoint to confirm the account is signed in and ready to trade. The JSON is the same as for MetaTrader 5, so one client reads all three platforms.

## How account data works on cTrader

- **Netting or hedging.** cTrader accounts come in both kinds, as MT5 accounts do; read marginMode from /AccountInfo before trading. On a netting account all trades on a symbol add up to one position, on a hedging account each trade is its own position.
- **Orders, deals and positions.** Like MT5, an order is the request, a deal an execution, a position what stays open. /OrderHistory returns the deals, with entry In, Out or InOut (a reversal on a netting account), and position links the deals of one round trip.
- **Everything in UTC.** Every time is real UTC, history included, so there is no broker server time to convert.
- **What cTrader does not share.** The account holder's name and the stop-out levels are not part of the Open API, so name is empty and those levels are 0.

Base URL: `https://api.fxsocket.com/ctrader/{account_id}`

### GET /ctrader/{account_id}/AccountSummary

Snapshot of the trading account: balance, credit, floating profit, equity, margin, free margin, margin level, leverage, account currency, and account type (Demo or Real). Read from cTrader at call time.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/ctrader/{account_id}/AccountSummary
```

Response:

```json
{
  "balance": 998.17,
  "credit": 0.0,
  "profit": 0.0,
  "equity": 998.17,
  "margin": 0.0,
  "freeMargin": 998.17,
  "marginLevel": 0.0,
  "leverage": 100,
  "currency": "EUR",
  "type": "Demo"
}
```

### GET /ctrader/{account_id}/AccountInfo

Static configuration of the account, as opposed to the live financials in /AccountSummary: login, broker, currency, leverage, account type, margin mode and trade permissions. marginMode is Hedging or Netting: read it before trading, since on a netting account all trades on a symbol add up to one position. On cTrader, name is empty (the Open API does not share the holder's name), and marginCallLevel, stopOutLevel and limitOrders are 0.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/ctrader/{account_id}/AccountInfo
```

Response:

```json
{
  "name": "",
  "login": 4123456,
  "server": "Spotware (demo)",
  "company": "Spotware",
  "currency": "EUR",
  "currencyDigits": 2,
  "leverage": 100,
  "type": "Demo",
  "marginMode": "Hedging",
  "marginSoMode": "Percent",
  "marginCallLevel": 0.0,
  "stopOutLevel": 0.0,
  "tradeAllowed": true,
  "tradeExpert": true,
  "limitOrders": 0,
  "fifoClose": false
}
```

### GET /ctrader/{account_id}/OpenedOrders

All open positions and active pending orders: one row per position and one per pending order (limit or stop). kind discriminates the two. A position's currentPrice is the price it would close at; a pending order's is the price it would fill at (the ask for a buy, the bid for a sell), and pending orders carry zero swap and profit. For a pending order's volumes and expiry, use /PendingOrders.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/ctrader/{account_id}/OpenedOrders
```

Response:

```json
[{
  "ticket": 302262716,
  "symbol": "EURUSD",
  "type": "Buy",
  "kind": "position",
  "lots": 0.01,
  "openPrice": 1.11685,
  "currentPrice": 1.11662,
  "stopLoss": 0.0,
  "takeProfit": 0.0,
  "swap": 0.0,
  "profit": -0.21,
  "magic": 26111001,
  "comment": "my-strategy",
  "openTime": "2026-11-10T22:38:46.909Z"
}, {
  "ticket": 328022021,
  "symbol": "EURUSD",
  "type": "BuyLimit",
  "kind": "pending",
  "lots": 0.01,
  "openPrice": 1.05,
  "currentPrice": 1.11661,
  "stopLoss": 1.04,
  "takeProfit": 1.07,
  "swap": 0.0,
  "profit": 0.0,
  "magic": 777,
  "comment": "docs",
  "openTime": "2026-11-10T23:01:07.512Z"
}]
```

### GET /ctrader/{account_id}/PendingOrders

Active pending orders only, with everything needed to copy or rebuild one: the volume it was placed with and the volume still to fill, stops, and its expiry. expirationMode is gtc (until cancelled) or specified (at expiration); cTrader has no end-of-day expiry. stopLimitPrice is always 0, since stop-limit orders are not offered on cTrader. All times are real UTC, so expiration and expirationUtc, time and timeUtc, are the same.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/ctrader/{account_id}/PendingOrders
```

Response:

```json
[{
  "ticket": 328022021,
  "symbol": "EURUSD",
  "type": "BuyLimit",
  "volumeInitial": 0.01,
  "volume": 0.01,
  "price": 1.05,
  "stopLimitPrice": 0.0,
  "sl": 1.04,
  "tp": 1.07,
  "expirationMode": "specified",
  "expiration": "2026-11-11T23:01:07.000Z",
  "expirationUtc": "2026-11-11T23:01:07.000Z",
  "magic": 777,
  "comment": "docs",
  "time": "2026-11-10T23:01:07.512Z",
  "timeUtc": "2026-11-10T23:01:07.512Z"
}]
```

### GET /ctrader/{account_id}/OrderHistory

Executed deals in a time range, newest last: one row per fill, entry In for the deal that opened or added to a position, Out for one that reduced or closed it, and InOut for one that reversed a position on a netting account. position links the deals of one round trip. Deposits, withdrawals and other balance operations are listed the way MT5 lists them: type Balance (Bonus, Charge or Commission for those kinds), entry In, no symbol or volume, the amount in profit (negative when money left the account) and the broker's note in comment, reaching back about two years. Omit both bounds to fetch all-time history.

Parameters:

- `from`: Inclusive lower bound (UTC). ISO-8601 (2026-01-01T00:00:00Z) or YYYY-MM-DD. Absent → epoch.
- `to`: Inclusive upper bound, same formats. Absent → now.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  "https://api.fxsocket.com/ctrader/{account_id}/OrderHistory?from=2026-01-01&to=2026-12-31"
```

Response:

```json
[{
  "ticket": 156570289,
  "order": 0,
  "position": 0,
  "symbol": "",
  "type": "Balance",
  "entry": "In",
  "volume": 0.0,
  "price": 0.0,
  "commission": 0.0,
  "swap": 0.0,
  "profit": 1000.0,
  "magic": 0,
  "comment": "Deposit",
  "time": "2026-11-06T20:01:04.534Z"
}, {
  "ticket": 343051307,
  "order": 328018035,
  "position": 302262716,
  "symbol": "EURUSD",
  "type": "Buy",
  "entry": "In",
  "volume": 0.01,
  "price": 1.11685,
  "commission": -0.05,
  "swap": 0.0,
  "profit": 0.0,
  "magic": 26111001,
  "comment": "my-strategy",
  "time": "2026-11-10T22:38:46.909Z"
}, {
  "ticket": 343051320,
  "order": 328018048,
  "position": 302262716,
  "symbol": "EURUSD",
  "type": "Sell",
  "entry": "Out",
  "volume": 0.01,
  "price": 1.11662,
  "commission": -0.05,
  "swap": 0.0,
  "profit": -0.21,
  "magic": 26111001,
  "comment": "my-strategy",
  "time": "2026-11-10T22:38:51.590Z"
}]
```

### GET /ctrader/{account_id}/PositionHistory

Closed positions in a time range: one row per round trip (open → close), reassembled from its deals with volume-weighted open and close prices, so a position closed in several parts is still one row. commission adds up both sides. Use /OrderHistory when you need the raw deals. Omit both bounds to fetch all-time history.

Parameters:

- `from`: Inclusive lower bound (UTC). ISO-8601 (2026-01-01T00:00:00Z) or YYYY-MM-DD. Absent → epoch.
- `to`: Inclusive upper bound, same formats. Absent → now.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  "https://api.fxsocket.com/ctrader/{account_id}/PositionHistory?from=2026-01-01&to=2026-12-31"
```

Response:

```json
[{
  "positionId": 302262716,
  "symbol": "EURUSD",
  "type": "Buy",
  "volume": 0.01,
  "openTime": "2026-11-10T22:38:46.909Z",
  "openPrice": 1.11685,
  "closeTime": "2026-11-10T22:38:51.590Z",
  "closePrice": 1.11662,
  "profit": -0.21,
  "swap": 0.0,
  "commission": -0.1,
  "netProfit": -0.31,
  "magic": 26111001,
  "comment": "my-strategy"
}]
```

### GET /ctrader/{account_id}/status

Connection health of the account, in one call: is the bridge connected to cTrader, is the account signed in, and is it ready to trade? Use this to confirm an account is live and trading-ready before sending orders. Always returns HTTP 200; read the body. The top-level status is ready (signed in and ready to trade), starting (still signing in), degraded (e.g. the connection to cTrader dropped), or down. terminal.build and terminal.pingMs are MetaTrader fields and read 0 here. bridge.version is the version of the cTrader bridge, 0.1.1 or later.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/ctrader/{account_id}/status
```

Response:

```json
{
  "status": "ready",
  "terminal": { "alive": true, "build": 0, "pingMs": 0 },
  "broker": { "connected": true, "server": "Spotware" },
  "account": {
    "loggedIn": true,
    "login": 4123456,
    "currency": "EUR",
    "type": "Demo",
    "tradeAllowed": true
  },
  "bridge": { "version": "0.1.1", "tradeEaReady": true, "symbolsSynced": true },
  "serverTime": "2026-11-10T23:01:05.670Z"
}
```

## Related

- [Trading](https://fxsocket.com/docs/ctrader/trading.md)
- [Market data](https://fxsocket.com/docs/ctrader/market-data.md)
- [WebSocket streams](https://fxsocket.com/docs/ctrader/websocket.md)
