Files
2026-02-21 07:43:33 +01:00

3.7 KiB

aiomql Documentation

API reference for the aiomql asynchronous MetaTrader 5 trading library.


Core

Low-level infrastructure: configuration, database, MT5 interface, data models, and shared state.

Module Description
_core Metaclass that dynamically binds MT5 constants and functions
base Base classes for attribute management and MT5 integration
config Singleton configuration manager (Config)
constants MT5 enumerations (TimeFrame, OrderType, TradeAction, …)
db SQLite ORM base class (DB) for dataclass-backed tables
errors MT5 error wrapper (Error)
exceptions Custom exception hierarchy
meta_trader Async/sync singleton interface to the MT5 terminal
models Data models (AccountInfo, SymbolInfo, TradeRequest, …)
state Singleton persistent key-value store (State)
store Per-key persistent store (Store)
task_queue Async priority task queue (TaskQueue, QueueItem)

Lib

High-level trading components: account, orders, positions, strategies, and the bot orchestrator.

Module Description
account Trading account connection manager
bot Bot orchestrator for running strategies
candle Candlestick/bar data and technical analysis
executor Strategy and task executor
history Historical deals and orders retrieval
order Trade order creation, checking, and sending
positions Open position management
ram Risk Assessment and Money management
result Trade result recording (CSV / JSON / SQL)
result_db SQLite-backed trade result storage
sessions Trading session time windows
strategy Strategy base class
symbol Trading instrument interface
terminal Terminal information retrieval
ticks Tick-level price data and analysis
trader Trader base class for order management
trade_records Trade record file management

Contrib

Community-contributed extensions: strategies, specialised symbols, position trackers, and traders.

Module Description
chaos Random buy/sell demo strategy
forex_symbol Forex-specific symbol with pip calculations
open_position Open position data container
position_trackers Position and open-positions tracker classes
position_tracking_functions Pre-built tracking functions (trailing stop, etc.)
scalp_trader Scalp trader (no stop levels)
simple_trader Simple trader (with stop loss)
strategy_tracker Strategy state tracking dataclass

Utils

General-purpose utilities: math helpers, price calculations, and parallel processing.

Module Description
utils Decorators, rounding, and async caching
price_utils Percentage-based price calculations
process_pool Multi-process parallel execution