# MT5 Python market_book_add()

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/platforms/metatrader-5/functions/python-market-book-add, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Subscribes the terminal to changes in the depth of market for one instrument, which is what makes market_book_get() return data.

- Function: `market_book_add()`
- Interface: MetaTrader5 Python package
- Group: Market depth
- Status: verified. Source: [mql5.com](https://www.mql5.com/en/docs/python_metatrader5/mt5marketbookadd_py), checked 2026-10-12.

This is a Python function, not an HTTP endpoint. It has no method, no path and no address to send a request to: the package talks to a MetaTrader 5 terminal running on the same computer. It is in no OpenAPI file on this site and the request builder does not list it.

Note: This subscribes the terminal, not the Python program: nothing is pushed to Python. The program still has to call market_book_get() to read the book.

## Signature

The form of the call on the vendor's page, with the vendor's comments taken out.

```python
market_book_add(
  symbol
)
```

## Arguments

- `symbol` (type not stated, required): The instrument's name. Given without a parameter name.

## Return value

- Type: `bool`
- What comes back: True on success, False otherwise.

## Sample

Written by this site from the signature and arguments recorded on this page. It has not been run against a terminal, a server or an account, and the values in it are placeholders. No credential is typed into it: where one is needed it is read from an environment variable on your own machine. Nothing is entered on this site.

```python
import MetaTrader5 as mt5

if not mt5.initialize():
    raise SystemExit(f"initialize() failed: {mt5.last_error()}")

if mt5.market_book_add("EURUSD"):
    print(mt5.market_book_get("EURUSD"))
    mt5.market_book_release("EURUSD")

mt5.shutdown()
```

## Related MT5 Python functions: Market depth

- [market_book_get()](https://openbrokerapi.com/platforms/metatrader-5/functions/python-market-book-get): Returns the current depth of market for one instrument, once market_book_add() has subscribed the terminal to it.
- [market_book_release()](https://openbrokerapi.com/platforms/metatrader-5/functions/python-market-book-release): Ends the terminal's subscription to depth of market changes for one instrument.

## More on MetaTrader 5

- [All MetaTrader 5 functions](https://openbrokerapi.com/platforms/metatrader-5/functions): 78 documented here, grouped by what they do.
- [Subscribe to a stream: the call at each API](https://openbrokerapi.com/endpoints/streaming-subscribe): The same job at every broker and platform API recorded here, HTTP or not.
- [MetaTrader 5 API quickstart](https://openbrokerapi.com/platforms/metatrader-5/quickstart)
- [All MetaTrader 5 error codes](https://openbrokerapi.com/errors/mt5)
- [MetaTrader 5 API page](https://openbrokerapi.com/platforms/metatrader-5): The full record: access, authentication, limits and the source for each.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: MT5 Python market_book_add(). Broker API Hub, https://openbrokerapi.com/platforms/metatrader-5/functions/python-market-book-add, newest check 2026-10-12.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
