BBSTRADER 2.4.0
Loading...
Searching...
No Matches
MT5::MetaTraderClient Class Reference

A client class that abstracts MetaTrader 5 functionality using injected handlers. More...

#include <metatrader.hpp>

Classes

struct  Handlers
 Container for all function callbacks required by the client. More...
 

Public Member Functions

 MetaTraderClient ()=delete
 Default constructor.
 
 MetaTraderClient (const MetaTraderClient &)=delete
 
MetaTraderClientoperator= (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MetaTraderClient()

MT5::MetaTraderClient::MetaTraderClient ( Handlers  handlers)
inlineexplicit

Constructor with handlers.

Parameters
handlersA struct containing the function implementations.

Member Function Documentation

◆ account_info()

virtual auto MT5::MetaTraderClient::account_info ( ) -> std::optional<AccountInfo>
inlinevirtual

Gets current account information.

Returns
Optional AccountInfo struct.

◆ copy_rates_from() [1/2]

virtual auto MT5::MetaTraderClient::copy_rates_from ( str s,
int32_t  t,
DateTime  from,
int32_t  count 
) -> RateInfoType
inlinevirtual

Copies rates from the MT5 terminal starting at a specific DateTime.

Parameters
sSymbol name.
tTimeframe.
fromStart DateTime (converted to timestamp).
countNumber of bars to retrieve.
Returns
Numpy array of RateInfo.

◆ copy_rates_from() [2/2]

virtual auto MT5::MetaTraderClient::copy_rates_from ( str s,
int32_t  t,
int64_t  from,
int32_t  count 
) -> RateInfoType
inlinevirtual

Copies rates starting at a specific timestamp.

Parameters
sSymbol name.
tTimeframe.
fromStart timestamp (seconds).
countNumber of bars.
Returns
Numpy array of RateInfo.

◆ copy_rates_from_pos()

virtual auto MT5::MetaTraderClient::copy_rates_from_pos ( str s,
int32_t  t,
int32_t  start,
int32_t  count 
) -> RateInfoType
inlinevirtual

Copies rates relative to the current position (index).

Parameters
sSymbol name.
tTimeframe.
startStart index.
countNumber of bars.
Returns
Numpy array of RateInfo.

◆ copy_rates_range() [1/2]

virtual auto MT5::MetaTraderClient::copy_rates_range ( str s,
int32_t  t,
DateTime  from,
DateTime  to 
) -> RateInfoType
inlinevirtual

Copies rates within a specific DateTime range.

Parameters
sSymbol name.
tTimeframe.
fromStart DateTime.
toEnd DateTime.
Returns
Numpy array of RateInfo.

◆ copy_rates_range() [2/2]

virtual auto MT5::MetaTraderClient::copy_rates_range ( str s,
int32_t  t,
int64_t  from,
int64_t  to 
) -> RateInfoType
inlinevirtual

Copies rates within a specific timestamp range.

Parameters
sSymbol name.
tTimeframe.
fromStart timestamp.
toEnd timestamp.
Returns
Numpy array of RateInfo.

◆ copy_ticks_from() [1/2]

virtual auto MT5::MetaTraderClient::copy_ticks_from ( str s,
DateTime  from,
int32_t  count,
int32_t  flags 
) -> TickInfoType
inlinevirtual

Copies ticks starting from a specific DateTime.

Parameters
sSymbol name.
fromStart DateTime.
countNumber of ticks.
flagsTick flags (info/trade/etc).
Returns
Numpy array of TickInfo.

◆ copy_ticks_from() [2/2]

virtual auto MT5::MetaTraderClient::copy_ticks_from ( str s,
int64_t  from,
int32_t  count,
int32_t  flags 
) -> TickInfoType
inlinevirtual

Copies ticks starting from a specific timestamp.

Parameters
sSymbol name.
fromStart timestamp.
countNumber of ticks.
flagsTick flags.
Returns
Numpy array of TickInfo.

◆ copy_ticks_range() [1/2]

virtual auto MT5::MetaTraderClient::copy_ticks_range ( str s,
DateTime  from,
DateTime  to,
int32_t  flags 
) -> TickInfoType
inlinevirtual

Copies ticks within a specific DateTime range.

Parameters
sSymbol name.
fromStart DateTime.
toEnd DateTime.
flagsTick flags.
Returns
Numpy array of TickInfo.

◆ copy_ticks_range() [2/2]

virtual auto MT5::MetaTraderClient::copy_ticks_range ( str s,
int64_t  from,
int64_t  to,
int32_t  flags 
) -> TickInfoType
inlinevirtual

Copies ticks within a specific timestamp range.

Parameters
sSymbol name.
fromStart timestamp.
toEnd timestamp.
flagsTick flags.
Returns
Numpy array of TickInfo.

◆ history_deals_get() [1/5]

virtual auto MT5::MetaTraderClient::history_deals_get ( DateTime  from,
DateTime  to 
) -> DealsData
inlinevirtual

Gets historical deals within a DateTime range.

Parameters
fromStart DateTime.
toEnd DateTime.
Returns
Optional vector of TradeDeal.

◆ history_deals_get() [2/5]

virtual auto MT5::MetaTraderClient::history_deals_get ( DateTime  from,
DateTime  to,
str group 
) -> DealsData
inlinevirtual

Gets historical deals within a DateTime range.

Parameters
fromStart DateTime.
toEnd DateTime.
groupGroup name filter.
Returns
Optional vector of TradeDeal.

◆ history_deals_get() [3/5]

virtual auto MT5::MetaTraderClient::history_deals_get ( int64_t  from,
int64_t  to 
) -> DealsData
inlinevirtual

Gets historical deals within a timestamp range.

Parameters
fromStart timestamp.
toEnd timestamp.
Returns
Optional vector of TradeDeal.

◆ history_deals_get() [4/5]

virtual auto MT5::MetaTraderClient::history_deals_get ( int64_t  from,
int64_t  to,
str group 
) -> DealsData
inlinevirtual

Gets historical deals within a timestamp range.

Parameters
fromStart timestamp.
toEnd timestamp.
groupGroup name filter
Returns
Optional vector of TradeDeal.

◆ history_deals_get() [5/5]

virtual auto MT5::MetaTraderClient::history_deals_get ( uint64_t  ticket) -> DealsData
inlinevirtual

Gets a historical deal by its ticket.

Parameters
ticketThe ticket number of the deal.
Returns
An optional vector of TradeDeal objects.

◆ history_deals_get_by_pos()

virtual auto MT5::MetaTraderClient::history_deals_get_by_pos ( uint64_t  pos_id) -> DealsData
inlinevirtual

Gets historical deals associated with a position ID.

Parameters
pos_idThe position ID.
Returns
Optional vector of TradeDeal.

◆ history_deals_total() [1/2]

virtual auto MT5::MetaTraderClient::history_deals_total ( DateTime  from,
DateTime  to 
) -> std::optional<int32_t>
inlinevirtual

Gets the count of historical deals in a DateTime range.

Parameters
fromStart DateTime.
toEnd DateTime.
Returns
The total number of historical deals, or 0 if the handler is not available.

◆ history_deals_total() [2/2]

virtual auto MT5::MetaTraderClient::history_deals_total ( int64_t  from,
int64_t  to 
) -> std::optional<int32_t>
inlinevirtual

Gets the count of historical deals in a timestamp range.

Parameters
fromStart timestamp.
toEnd timestamp.
Returns
The total number of historical deals, or std::nullopt if the handler is not available.

◆ history_orders_get() [1/5]

virtual auto MT5::MetaTraderClient::history_orders_get ( DateTime  from,
DateTime  to 
) -> OrdersData
inlinevirtual

Gets historical orders within a DateTime range.

Parameters
fromStart DateTime.
toEnd DateTime.
Returns
Optional vector of TradeOrder.

◆ history_orders_get() [2/5]

virtual auto MT5::MetaTraderClient::history_orders_get ( DateTime  from,
DateTime  to,
str group 
) -> OrdersData
inlinevirtual

Gets historical orders within a DateTime range.

Parameters
fromStart DateTime.
toEnd DateTime.
groupGroup name filter.
Returns
Optional vector of TradeOrder.

◆ history_orders_get() [3/5]

virtual auto MT5::MetaTraderClient::history_orders_get ( int64_t  from,
int64_t  to 
) -> OrdersData
inlinevirtual

Gets historical orders within a timestamp range.

Parameters
fromStart timestamp.
toEnd timestamp.
Returns
Optional vector of TradeOrder.

◆ history_orders_get() [4/5]

virtual auto MT5::MetaTraderClient::history_orders_get ( int64_t  from,
int64_t  to,
str group 
) -> OrdersData
inlinevirtual

Gets historical orders within a timestamp range.

Parameters
fromStart timestamp.
toEnd timestamp.
groupGroup name filter
Returns
Optional vector of TradeOrder.

◆ history_orders_get() [5/5]

virtual auto MT5::MetaTraderClient::history_orders_get ( uint64_t  ticket) -> std::optional<TradeOrder>
inlinevirtual

Gets a historical order by its ticket.

Parameters
ticketThe ticket number of the order.
Returns
An optional containing the TradeOrder if found, otherwise std::nullopt.

◆ history_orders_get_by_pos()

virtual auto MT5::MetaTraderClient::history_orders_get_by_pos ( uint64_t  pos_id) -> OrdersData
inlinevirtual

Gets historical orders associated with a position ID.

Parameters
pos_idThe position ID.
Returns
Optional vector of TradeOrder.

◆ history_orders_total() [1/2]

virtual auto MT5::MetaTraderClient::history_orders_total ( DateTime  from,
DateTime  to 
) -> std::optional<int32_t>
inlinevirtual

Gets the count of historical orders in a DateTime range.

Parameters
fromStart DateTime.
toEnd DateTime.
Returns
The total number of historical orders, or 0 if the handler is not available.

◆ history_orders_total() [2/2]

virtual auto MT5::MetaTraderClient::history_orders_total ( int64_t  from,
int64_t  to 
) -> std::optional<int32_t>
inlinevirtual

Gets the count of historical orders in a timestamp range.

Parameters
fromStart timestamp.
toEnd timestamp.
Returns
The total number of historical orders, or std::nullopt if the handler is not available.

◆ initialize() [1/3]

virtual auto MT5::MetaTraderClient::initialize ( ) -> bool
inlinevirtual

Initializes the MT5 terminal automatically.

Returns
True if successful, false otherwise.

◆ initialize() [2/3]

virtual auto MT5::MetaTraderClient::initialize ( str path) -> bool
inlinevirtual

Initializes the MT5 terminal at a specific path.

Parameters
pathPath to the MT5 terminal executable or directory.
Returns
True if successful, false otherwise.

◆ initialize() [3/3]

virtual auto MT5::MetaTraderClient::initialize ( str path,
uint64_t  account,
str pw,
str srv,
uint32_t  timeout,
bool  portable 
) -> bool
inlinevirtual

Initializes the MT5 terminal with full configuration.

Parameters
pathPath to MT5.
accountAccount number.
pwPassword.
srvServer name.
timeoutConnection timeout in milliseconds.
portableBoolean flag for portable mode.
Returns
True if successful, false otherwise.

◆ last_error()

virtual auto MT5::MetaTraderClient::last_error ( ) -> std::optional<LastErrorResult>
inlinevirtual

Gets the last error occurred.

Returns
Optional LastErrorResult tuple (code, description). Returns (-1, "fail") if handler missing.

◆ login()

virtual auto MT5::MetaTraderClient::login ( uint64_t  account,
str pw,
str srv,
uint32_t  timeout 
) -> bool
inlinevirtual

Connects to a trading account.

Parameters
accountAccount number.
pwPassword.
srvServer name.
timeoutConnection timeout.
Returns
True if login successful, false otherwise.

◆ market_book_add()

virtual auto MT5::MetaTraderClient::market_book_add ( str symbol) -> bool
inlinevirtual

Subscribes to the Market Book (Depth of Market) for a symbol.

Parameters
symbolSymbol name.
Returns
True if subscription successful.

◆ market_book_get()

virtual auto MT5::MetaTraderClient::market_book_get ( str symbol) -> BookData
inlinevirtual

Gets the current Market Book state.

Parameters
symbolSymbol name.
Returns
Optional vector of BookInfo.

◆ market_book_release()

virtual auto MT5::MetaTraderClient::market_book_release ( str symbol) -> bool
inlinevirtual

Unsubscribes from the Market Book for a symbol.

Parameters
symbolSymbol name.
Returns
True if unsubscription successful.

◆ order_calc_margin()

virtual auto MT5::MetaTraderClient::order_calc_margin ( int32_t  action,
str sym,
double  vol,
double  prc 
) -> std::optional<double>
inlinevirtual

Calculates the margin required for an order.

Parameters
actionOrder action (buy/sell).
symSymbol name.
volVolume.
prcPrice.
Returns
Required margin or nullopt.

◆ order_calc_profit()

virtual auto MT5::MetaTraderClient::order_calc_profit ( int32_t  action,
str sym,
double  vol,
double  open,
double  close 
) -> std::optional<double>
inlinevirtual

Calculates the potential profit for an order.

Parameters
actionOrder action.
symSymbol name.
volVolume.
openOpen price.
closeClose price.
Returns
Profit or nullopt.

◆ order_check() [1/2]

virtual auto MT5::MetaTraderClient::order_check ( const py::dict &  dict) -> std::optional<OrderCheckResult>
inlinevirtual

Checks if a trade request is valid (Python dict overload).

Parameters
dictPython dictionary representing the trade request.
Returns
Optional OrderCheckResult.

◆ order_check() [2/2]

virtual auto MT5::MetaTraderClient::order_check ( const TradeRequest req) -> std::optional<OrderCheckResult>
inlinevirtual

Checks if a trade request is valid.

Parameters
reqTradeRequest structure.
Returns
Optional OrderCheckResult.

◆ order_get_by_ticket()

virtual auto MT5::MetaTraderClient::order_get_by_ticket ( uint64_t  ticket) -> std::optional<TradeOrder>
inlinevirtual

Gets a specific order by its ticket number.

Parameters
ticketThe ticket number of the order.
Returns
An optional containing the TradeOrder if found, otherwise std::nullopt.

◆ order_send() [1/2]

virtual auto MT5::MetaTraderClient::order_send ( const py::dict &  dict) -> std::optional<OrderSentResult>
inlinevirtual

Sends a trade request to the server (Python dict overload).

Parameters
dictPython dictionary representing the trade request.
Returns
Optional OrderSentResult.

◆ order_send() [2/2]

virtual auto MT5::MetaTraderClient::order_send ( const TradeRequest req) -> std::optional<OrderSentResult>
inlinevirtual

Sends a trade request to the server.

Parameters
reqTradeRequest structure.
Returns
Optional OrderSentResult.

◆ orders_get() [1/2]

virtual auto MT5::MetaTraderClient::orders_get ( ) -> OrdersData
inlinevirtual

Gets all active orders.

Returns
Optional vector of TradeOrder.

◆ orders_get() [2/2]

virtual auto MT5::MetaTraderClient::orders_get ( str symbol) -> OrdersData
inlinevirtual

Gets active orders for a specific symbol.

Parameters
symbolSymbol name.
Returns
Optional vector of TradeOrder.

◆ orders_get_by_group()

virtual auto MT5::MetaTraderClient::orders_get_by_group ( str group) -> OrdersData
inlinevirtual

Gets active orders for a specific symbol group.

Parameters
groupGroup name pattern.
Returns
Optional vector of TradeOrder.

◆ orders_total()

virtual auto MT5::MetaTraderClient::orders_total ( ) -> std::optional<int32_t>
inlinevirtual

Gets total number of active orders.

Returns
The total number of active orders, or std::nullopt if the handler is not available.

◆ position_get_by_ticket()

virtual auto MT5::MetaTraderClient::position_get_by_ticket ( uint64_t  ticket) -> std::optional<TradePosition>
inlinevirtual

Gets a specific position by its ticket.

Parameters
ticketThe ticket number of the position.
Returns
An optional containing the TradePosition if found, otherwise std::nullopt.

◆ positions_get() [1/2]

virtual auto MT5::MetaTraderClient::positions_get ( ) -> PositionsData
inlinevirtual

Gets all open positions.

Returns
Optional vector of TradePosition.

◆ positions_get() [2/2]

virtual auto MT5::MetaTraderClient::positions_get ( str symbol) -> PositionsData
inlinevirtual

Gets open positions for a specific symbol.

Parameters
symbolSymbol name.
Returns
Optional vector of TradePosition.

◆ positions_get_by_group()

virtual auto MT5::MetaTraderClient::positions_get_by_group ( str group) -> PositionsData
inlinevirtual

Gets open positions for a specific group.

Parameters
groupGroup name pattern.
Returns
Optional vector of TradePosition.

◆ positions_total()

virtual auto MT5::MetaTraderClient::positions_total ( ) -> std::optional<int32_t>
inlinevirtual

Gets total number of open positions.

Returns
The total number of open positions, or std::nullopt if the handler is not available.

◆ symbol_info()

virtual auto MT5::MetaTraderClient::symbol_info ( str symbol) -> std::optional<SymbolInfo>
inlinevirtual

Gets information for a specific symbol.

Parameters
symbolSymbol name.
Returns
Optional SymbolInfo struct.

◆ symbol_info_tick()

virtual auto MT5::MetaTraderClient::symbol_info_tick ( str symbol) -> std::optional<TickInfo>
inlinevirtual

Gets the current tick info for a symbol.

Parameters
symbolSymbol name.
Returns
Optional TickInfo struct.

◆ symbol_select()

virtual auto MT5::MetaTraderClient::symbol_select ( str symbol,
bool  enable 
) -> bool
inlinevirtual

Selects or deselects a symbol in the Market Watch window.

Parameters
symbolSymbol name.
enableTrue to select, false to deselect.
Returns
True if successful.

◆ symbols_get() [1/2]

virtual auto MT5::MetaTraderClient::symbols_get ( ) -> SymbolsData
inlinevirtual

Gets all available symbols.

Returns
Optional vector of SymbolInfo.

◆ symbols_get() [2/2]

virtual auto MT5::MetaTraderClient::symbols_get ( str group) -> SymbolsData
inlinevirtual

Gets symbols for a specific group (e.g., "EUR*").

Parameters
groupGroup name pattern.
Returns
Optional vector of SymbolInfo.

◆ symbols_total()

virtual auto MT5::MetaTraderClient::symbols_total ( ) -> std::optional<int32_t>
inlinevirtual

Gets the total number of available symbols.

Returns
Number of symbols, or std::nullopt if the handler is not available.

◆ terminal_info()

virtual auto MT5::MetaTraderClient::terminal_info ( ) -> std::optional<TerminalInfo>
inlinevirtual

Gets terminal status and settings.

Returns
Optional TerminalInfo struct.

◆ version()

virtual auto MT5::MetaTraderClient::version ( ) -> std::optional<VersionInfo>
inlinevirtual

Gets the MT5 version information.

Returns
Optional VersionInfo tuple.

The documentation for this class was generated from the following file: