backtrader.brokers package

Brokers Module - Order execution and portfolio management.

This module provides broker implementations for order execution and portfolio management. Brokers handle order routing, position tracking, cash management, and trade history.

Available Brokers:
  • BackBroker: Built-in backtesting broker.

  • TickBroker: Tick and order book matching backtesting broker.

  • BtApiBroker: Unified bt_api_py live trading broker.

Example

Setting the broker in cerebro: >>> cerebro = bt.Cerebro() >>> cerebro.setbroker(bt.brokers.BackBroker())

Submodules