Files
aiomql/docs/lib/bot.md
T
2026-02-21 07:43:33 +01:00

1.5 KiB

bot

aiomql.lib.bot — Bot orchestrator for running trading strategies.

Overview

The Bot class is the main entry point for running one or more trading strategies against the MetaTrader 5 terminal. It manages the account connection lifecycle, strategy initialisation, task queuing, and graceful shutdown via signal handlers.

Inherits from _Base.

Classes

Bot

Orchestrates strategy execution and terminal connection.

Attribute Type Description
account Account The trading account instance
executor Executor Strategy and task executor
mt5 MetaTrader MetaTrader terminal interface

Lifecycle

Method Description
initialize() Connects to MT5 and logs in, sets up the executor
start() Starts the bot: initialises, adds strategies, and runs the executor
stop() Gracefully stops the bot and shuts down the terminal
execute() Main execution loop

Strategy Management

Method Description
add_strategy(strategy) Registers a Strategy subclass for execution
add_strategies(*strategies) Registers multiple strategies at once

Signal Handling

Method Description
sigint_handler(sig, frame) Handles SIGINT for graceful shutdown

Synchronous API

A synchronous variant is available in aiomql.lib.sync.bot.