A client class that abstracts MetaTrader 5 functionality using injected handlers.
More...
|
|
| MetaTraderClient ()=delete |
| | Default constructor.
|
| |
|
| MetaTraderClient (const MetaTraderClient &)=delete |
| |
|
MetaTraderClient & | operator= (const MetaTraderClient &)=delete |
| |
|
virtual | ~MetaTraderClient ()=default |
| | Virtual destructor.
|
| |
| | MetaTraderClient (Handlers handlers) |
| | Constructor with handlers.
|
| |
| virtual auto | initialize () -> bool |
| | Initializes the MT5 terminal automatically.
|
| |
| virtual auto | initialize (str &path) -> bool |
| | Initializes the MT5 terminal at a specific path.
|
| |
| virtual auto | initialize (str &path, uint64_t account, str &pw, str &srv, uint32_t timeout, bool portable) -> bool |
| | Initializes the MT5 terminal with full configuration.
|
| |
| virtual auto | login (uint64_t account, str &pw, str &srv, uint32_t timeout) -> bool |
| | Connects to a trading account.
|
| |
|
virtual auto | shutdown () noexcept -> void |
| | Shuts down the MT5 connection/terminal.
|
| |
| virtual auto | version () -> std::optional< VersionInfo > |
| | Gets the MT5 version information.
|
| |
| virtual auto | last_error () -> std::optional< LastErrorResult > |
| | Gets the last error occurred.
|
| |
| virtual auto | terminal_info () -> std::optional< TerminalInfo > |
| | Gets terminal status and settings.
|
| |
| virtual auto | account_info () -> std::optional< AccountInfo > |
| | Gets current account information.
|
| |
| virtual auto | symbols_total () -> std::optional< int32_t > |
| | Gets the total number of available symbols.
|
| |
| virtual auto | symbols_get () -> SymbolsData |
| | Gets all available symbols.
|
| |
| virtual auto | symbols_get (str &group) -> SymbolsData |
| | Gets symbols for a specific group (e.g., "EUR*").
|
| |
| virtual auto | symbol_info (str &symbol) -> std::optional< SymbolInfo > |
| | Gets information for a specific symbol.
|
| |
| virtual auto | symbol_select (str &symbol, bool enable) -> bool |
| | Selects or deselects a symbol in the Market Watch window.
|
| |
| virtual auto | symbol_info_tick (str &symbol) -> std::optional< TickInfo > |
| | Gets the current tick info for a symbol.
|
| |
| virtual auto | market_book_add (str &symbol) -> bool |
| | Subscribes to the Market Book (Depth of Market) for a symbol.
|
| |
| virtual auto | market_book_release (str &symbol) -> bool |
| | Unsubscribes from the Market Book for a symbol.
|
| |
| virtual auto | market_book_get (str &symbol) -> BookData |
| | Gets the current Market Book state.
|
| |
| virtual auto | copy_rates_from (str &s, int32_t t, DateTime from, int32_t count) -> RateInfoType |
| | Copies rates from the MT5 terminal starting at a specific DateTime.
|
| |
| virtual auto | copy_rates_from (str &s, int32_t t, int64_t from, int32_t count) -> RateInfoType |
| | Copies rates starting at a specific timestamp.
|
| |
| virtual auto | copy_rates_from_pos (str &s, int32_t t, int32_t start, int32_t count) -> RateInfoType |
| | Copies rates relative to the current position (index).
|
| |
| virtual auto | copy_rates_range (str &s, int32_t t, DateTime from, DateTime to) -> RateInfoType |
| | Copies rates within a specific DateTime range.
|
| |
| virtual auto | copy_rates_range (str &s, int32_t t, int64_t from, int64_t to) -> RateInfoType |
| | Copies rates within a specific timestamp range.
|
| |
| virtual auto | copy_ticks_from (str &s, DateTime from, int32_t count, int32_t flags) -> TickInfoType |
| | Copies ticks starting from a specific DateTime.
|
| |
| virtual auto | copy_ticks_from (str &s, int64_t from, int32_t count, int32_t flags) -> TickInfoType |
| | Copies ticks starting from a specific timestamp.
|
| |
| virtual auto | copy_ticks_range (str &s, DateTime from, DateTime to, int32_t flags) -> TickInfoType |
| | Copies ticks within a specific DateTime range.
|
| |
| virtual auto | copy_ticks_range (str &s, int64_t from, int64_t to, int32_t flags) -> TickInfoType |
| | Copies ticks within a specific timestamp range.
|
| |
| virtual auto | orders_get () -> OrdersData |
| | Gets all active orders.
|
| |
| virtual auto | orders_get (str &symbol) -> OrdersData |
| | Gets active orders for a specific symbol.
|
| |
| virtual auto | orders_get_by_group (str &group) -> OrdersData |
| | Gets active orders for a specific symbol group.
|
| |
| virtual auto | order_get_by_ticket (uint64_t ticket) -> std::optional< TradeOrder > |
| | Gets a specific order by its ticket number.
|
| |
| virtual auto | orders_total () -> std::optional< int32_t > |
| | Gets total number of active orders.
|
| |
| virtual auto | positions_get () -> PositionsData |
| | Gets all open positions.
|
| |
| virtual auto | positions_get (str &symbol) -> PositionsData |
| | Gets open positions for a specific symbol.
|
| |
| virtual auto | positions_get_by_group (str &group) -> PositionsData |
| | Gets open positions for a specific group.
|
| |
| virtual auto | position_get_by_ticket (uint64_t ticket) -> std::optional< TradePosition > |
| | Gets a specific position by its ticket.
|
| |
| virtual auto | positions_total () -> std::optional< int32_t > |
| | Gets total number of open positions.
|
| |
| virtual auto | order_check (const py::dict &dict) -> std::optional< OrderCheckResult > |
| | Checks if a trade request is valid (Python dict overload).
|
| |
| virtual auto | order_check (const TradeRequest &req) -> std::optional< OrderCheckResult > |
| | Checks if a trade request is valid.
|
| |
| virtual auto | order_send (const py::dict &dict) -> std::optional< OrderSentResult > |
| | Sends a trade request to the server (Python dict overload).
|
| |
| virtual auto | order_send (const TradeRequest &req) -> std::optional< OrderSentResult > |
| | Sends a trade request to the server.
|
| |
| virtual auto | order_calc_margin (int32_t action, str &sym, double vol, double prc) -> std::optional< double > |
| | Calculates the margin required for an order.
|
| |
| virtual auto | order_calc_profit (int32_t action, str &sym, double vol, double open, double close) -> std::optional< double > |
| | Calculates the potential profit for an order.
|
| |
| virtual auto | history_orders_get (int64_t from, int64_t to, str &group) -> OrdersData |
| | Gets historical orders within a timestamp range.
|
| |
| virtual auto | history_orders_get (DateTime from, DateTime to, str &group) -> OrdersData |
| | Gets historical orders within a DateTime range.
|
| |
| virtual auto | history_orders_get (int64_t from, int64_t to) -> OrdersData |
| | Gets historical orders within a timestamp range.
|
| |
| virtual auto | history_orders_get (DateTime from, DateTime to) -> OrdersData |
| | Gets historical orders within a DateTime range.
|
| |
| virtual auto | history_orders_get (uint64_t ticket) -> std::optional< TradeOrder > |
| | Gets a historical order by its ticket.
|
| |
| virtual auto | history_orders_get_by_pos (uint64_t pos_id) -> OrdersData |
| | Gets historical orders associated with a position ID.
|
| |
| virtual auto | history_orders_total (int64_t from, int64_t to) -> std::optional< int32_t > |
| | Gets the count of historical orders in a timestamp range.
|
| |
| virtual auto | history_orders_total (DateTime from, DateTime to) -> std::optional< int32_t > |
| | Gets the count of historical orders in a DateTime range.
|
| |
| virtual auto | history_deals_get (int64_t from, int64_t to, str &group) -> DealsData |
| | Gets historical deals within a timestamp range.
|
| |
| virtual auto | history_deals_get (int64_t from, int64_t to) -> DealsData |
| | Gets historical deals within a timestamp range.
|
| |
| virtual auto | history_deals_get (DateTime from, DateTime to, str &group) -> DealsData |
| | Gets historical deals within a DateTime range.
|
| |
| virtual auto | history_deals_get (DateTime from, DateTime to) -> DealsData |
| | Gets historical deals within a DateTime range.
|
| |
| virtual auto | history_deals_get (uint64_t ticket) -> DealsData |
| | Gets a historical deal by its ticket.
|
| |
| virtual auto | history_deals_get_by_pos (uint64_t pos_id) -> DealsData |
| | Gets historical deals associated with a position ID.
|
| |
| virtual auto | history_deals_total (int64_t from, int64_t to) -> std::optional< int32_t > |
| | Gets the count of historical deals in a timestamp range.
|
| |
| virtual auto | history_deals_total (DateTime from, DateTime to) -> std::optional< int32_t > |
| | Gets the count of historical deals in a DateTime range.
|
| |
A client class that abstracts MetaTrader 5 functionality using injected handlers.
This class acts as a facade, delegating actual API calls to a set of std::function handlers provided at construction.