# Symbols and prices

Source: https://docs.pipsocket.com/api/symbols

The broker's symbols, their specifications and prices.

All calls: `https://api.pipsocket.com`, with `Authorization: Bearer <your workspace key>`.

## List symbols

`GET /v1/accounts/{account}/symbols`

Every symbol the broker offers the account, in Market Watch or not, read from the terminal. Large brokers list thousands; read a symbol for its full specification.

### Path

- `account` (string, required): The account's id, `acc_` and 26 characters, as the dashboard shows it.

### Response

A list of:

- `name` (string, MT5 `SYMBOL_NAME`): 
- `description` (string, MT5 `SYMBOL_DESCRIPTION`): 
- `path` (string, MT5 `SYMBOL_PATH`): Where it sits in the broker's symbol tree.
- `available` (boolean): Whether the terminal could read its properties.
- `digits` (integer, MT5 `SYMBOL_DIGITS`): 
- `contract_size` (number, MT5 `SYMBOL_TRADE_CONTRACT_SIZE`): 
- `currency_base` (string, MT5 `SYMBOL_CURRENCY_BASE`): 
- `currency_profit` (string, MT5 `SYMBOL_CURRENCY_PROFIT`): 
- `currency_margin` (string, MT5 `SYMBOL_CURRENCY_MARGIN`): 
- `trading` (enum, or null): MT5's `SYMBOL_TRADE_MODE`: whether and which way the symbol can be traded. One of: `disabled`, `long_only`, `short_only`, `close_only`, `full`.
- `volume_min` (number, MT5 `SYMBOL_VOLUME_MIN`): 
- `volume_max` (number, MT5 `SYMBOL_VOLUME_MAX`): 
- `volume_step` (number, MT5 `SYMBOL_VOLUME_STEP`): 
- `in_market_watch` (boolean, MT5 `SYMBOL_SELECT`): Whether it is in the terminal's Market Watch.

### Answers

- 200: Every symbol.
- 401: - `missing_api_key`: No API key: send it as `Authorization: Bearer <key>`.; `invalid_api_key`: The key is not a workspace's current key (a rolled key stops working within about a minute).
- 404: - `no_such_account`: No such account, or one the key's workspace doesn't have: the two look the same.
- 503: - `account_not_connected`: The account's terminal is not connected to the engine (stopped, starting, or restarting). Nothing was sent, except by the kill switch: engaging it still engages it, and may already have deleted pending orders.; `terminal_error`: The terminal did not give the answer asked for.; `symbol_too_large`: One symbol's entry is too large for the terminal to list.; `engine_busy`: The account's engine host has too many calls in flight (256). Nothing was done; try again.; `engine_unavailable`: The account's engine host is not connected to Pipsocket, or disconnected while the call waited. A trade it already had is still settled: look it up.
- 504: - `terminal_timeout`: The account's terminal did not answer within 5 seconds.; `engine_timeout`: The account's engine did not answer within 30 seconds.

### Example

```bash
curl "https://api.pipsocket.com/v1/accounts/acc_01m6tx3k9f2qw8r7bznd5yvh4c/symbols" \
  -H "Authorization: Bearer $PIPSOCKET_KEY"
```

200 symbols:

```json
[
  {
    "available": true,
    "contract_size": 100000,
    "currency_base": "EUR",
    "currency_margin": "EUR",
    "currency_profit": "USD",
    "description": "Euro vs US Dollar",
    "digits": 5,
    "in_market_watch": true,
    "name": "EURUSD",
    "path": "Forex\\EURUSD",
    "trading": "full",
    "volume_max": 500,
    "volume_min": 0.01,
    "volume_step": 0.01
  }
]
```

## Get a symbol

`GET /v1/accounts/{account}/symbols/{symbol}`

A symbol's specification from the terminal: digits, contract size, volume limits, stops and freeze levels, and the filling modes, execution, order types and expirations it allows.

### Path

- `account` (string, required): The account's id, `acc_` and 26 characters, as the dashboard shows it.
- `symbol` (string, required): The symbol exactly as the broker names it, such as `EURUSD`.

### Response

- `name` (string, MT5 `SYMBOL_NAME`): 
- `available` (boolean): Whether the terminal could read its properties; when false the rest are empty values.
- `description` (string, MT5 `SYMBOL_DESCRIPTION`): 
- `digits` (integer, MT5 `SYMBOL_DIGITS`): 
- `point` (number, MT5 `SYMBOL_POINT`): 
- `tick_size` (number, MT5 `SYMBOL_TRADE_TICK_SIZE`): 
- `tick_value` (number, MT5 `SYMBOL_TRADE_TICK_VALUE`): 
- `contract_size` (number, MT5 `SYMBOL_TRADE_CONTRACT_SIZE`): 
- `volume_min` (number, MT5 `SYMBOL_VOLUME_MIN`): 
- `volume_max` (number, MT5 `SYMBOL_VOLUME_MAX`): 
- `volume_step` (number, MT5 `SYMBOL_VOLUME_STEP`): 
- `stops_level` (integer, MT5 `SYMBOL_TRADE_STOPS_LEVEL`): The closest stops may be to the price, in points.
- `freeze_level` (integer, MT5 `SYMBOL_TRADE_FREEZE_LEVEL`): How close to the price an order or stop is frozen, in points.
- `filling_mode` (integer, MT5 `SYMBOL_FILLING_MODE`): MT5's flags, as `filling_modes` spells them out.
- `trade_mode` (integer, MT5 `SYMBOL_TRADE_MODE`): MT5's value, as `trading` spells it out.
- `execution_mode` (integer, MT5 `SYMBOL_TRADE_EXEMODE`): MT5's value, as `execution` spells it out.
- `order_mode` (integer, MT5 `SYMBOL_ORDER_MODE`): MT5's flags, as `order_types` spells them out.
- `expiration_mode` (integer, MT5 `SYMBOL_EXPIRATION_MODE`): MT5's flags, as `expirations` spells them out.
- `currency_base` (string, MT5 `SYMBOL_CURRENCY_BASE`): 
- `currency_profit` (string, MT5 `SYMBOL_CURRENCY_PROFIT`): 
- `currency_margin` (string, MT5 `SYMBOL_CURRENCY_MARGIN`): 
- `filling_modes` (enum[]): The `type_filling` modes MT5's `SYMBOL_FILLING_MODE` flags allow. `return` has no flag: whether it is accepted depends on the symbol's execution and the broker.
- `execution` (enum, or null): MT5's `SYMBOL_TRADE_EXEMODE`. Instant and request execution need `price` (and use `deviation`). One of: `request`, `instant`, `market`, `exchange`.
- `order_types` (enum[]): The orders the symbol allows (MT5's `SYMBOL_ORDER_MODE`).
- `expirations` (enum[]): The `type_time` values the symbol allows (MT5's `SYMBOL_EXPIRATION_MODE`).
- `trading` (enum, or null): MT5's `SYMBOL_TRADE_MODE`: whether and which way the symbol can be traded. One of: `disabled`, `long_only`, `short_only`, `close_only`, `full`.

### Answers

- 200: The symbol.
- 401: - `missing_api_key`: No API key: send it as `Authorization: Bearer <key>`.; `invalid_api_key`: The key is not a workspace's current key (a rolled key stops working within about a minute).
- 404: - `no_such_account`: No such account, or one the key's workspace doesn't have: the two look the same.; `no_such_symbol`: The broker has no symbol by that name.
- 503: - `account_not_connected`: The account's terminal is not connected to the engine (stopped, starting, or restarting). Nothing was sent, except by the kill switch: engaging it still engages it, and may already have deleted pending orders.; `terminal_error`: The terminal did not give the answer asked for.; `engine_busy`: The account's engine host has too many calls in flight (256). Nothing was done; try again.; `engine_unavailable`: The account's engine host is not connected to Pipsocket, or disconnected while the call waited. A trade it already had is still settled: look it up.
- 504: - `terminal_timeout`: The account's terminal did not answer within 5 seconds.; `engine_timeout`: The account's engine did not answer within 30 seconds.

### Example

```bash
curl "https://api.pipsocket.com/v1/accounts/acc_01m6tx3k9f2qw8r7bznd5yvh4c/symbols/EURUSD" \
  -H "Authorization: Bearer $PIPSOCKET_KEY"
```

200 symbol:

```json
{
  "available": true,
  "contract_size": 100000,
  "currency_base": "EUR",
  "currency_margin": "EUR",
  "currency_profit": "USD",
  "description": "Euro vs US Dollar",
  "digits": 5,
  "execution": "market",
  "execution_mode": 2,
  "expiration_mode": 15,
  "expirations": [
    "gtc",
    "day",
    "specified",
    "specified_day"
  ],
  "filling_mode": 2,
  "filling_modes": [
    "ioc"
  ],
  "freeze_level": 0,
  "name": "EURUSD",
  "order_mode": 127,
  "order_types": [
    "market",
    "limit",
    "stop",
    "stop_limit",
    "sl",
    "tp",
    "close_by"
  ],
  "point": 0.00001,
  "stops_level": 0,
  "tick_size": 0.00001,
  "tick_value": 1,
  "trade_mode": 4,
  "trading": "full",
  "volume_max": 500,
  "volume_min": 0.01,
  "volume_step": 0.01
}
```

## Get a symbol's price

`GET /v1/accounts/{account}/symbols/{symbol}/tick`

The symbol's latest tick (MT5's `MqlTick`) from the terminal. A symbol the terminal has just added to Market Watch can take up to 2 seconds to have a price.

### Path

- `account` (string, required): The account's id, `acc_` and 26 characters, as the dashboard shows it.
- `symbol` (string, required): The symbol exactly as the broker names it, such as `EURUSD`.

### Response

- `symbol` (string): 
- `bid` (number, MT5 `bid`): 
- `ask` (number, MT5 `ask`): 
- `time_msc` (integer, or null, MT5 `time_msc`): Broker server time, milliseconds since 1970.
- `last` (number, or null, MT5 `last`): 
- `volume` (number, or null, MT5 `volume_real`): 
- `flags` (integer, or null, MT5 `flags`): MT5's `TICK_FLAG_*` bits: what changed.

### Answers

- 200: The latest tick.
- 401: - `missing_api_key`: No API key: send it as `Authorization: Bearer <key>`.; `invalid_api_key`: The key is not a workspace's current key (a rolled key stops working within about a minute).
- 404: - `no_such_account`: No such account, or one the key's workspace doesn't have: the two look the same.; `no_such_symbol`: The broker has no symbol by that name.
- 503: - `account_not_connected`: The account's terminal is not connected to the engine (stopped, starting, or restarting). Nothing was sent, except by the kill switch: engaging it still engages it, and may already have deleted pending orders.; `terminal_error`: The terminal did not give the answer asked for.; `no_price`: The terminal has no price for the symbol yet (it waited 2 seconds).; `engine_busy`: The account's engine host has too many calls in flight (256). Nothing was done; try again.; `engine_unavailable`: The account's engine host is not connected to Pipsocket, or disconnected while the call waited. A trade it already had is still settled: look it up.
- 504: - `terminal_timeout`: The account's terminal did not answer within 5 seconds.; `engine_timeout`: The account's engine did not answer within 30 seconds.

### Example

```bash
curl "https://api.pipsocket.com/v1/accounts/acc_01m6tx3k9f2qw8r7bznd5yvh4c/symbols/EURUSD/tick" \
  -H "Authorization: Bearer $PIPSOCKET_KEY"
```

200 tick:

```json
{
  "ask": 1.08412,
  "bid": 1.0841,
  "flags": 6,
  "last": 0,
  "symbol": "EURUSD",
  "time_msc": 1794067825114,
  "volume": 0
}
```
