BBSTRADER 2.4.0
Loading...
Searching...
No Matches
metatrader.hpp File Reference

Declares the public API for the Metatrader5 in the bbstrader library. This is the primary file that you should #include if you want to use the library. More...

Include dependency graph for metatrader.hpp:

Go to the source code of this file.

Classes

class  MT5::MetaTraderClient
 A client class that abstracts MetaTrader 5 functionality using injected handlers. More...
 
struct  MT5::MetaTraderClient::Handlers
 Container for all function callbacks required by the client. More...
 

Namespaces

namespace  MT5
 Namespace containing MetaTrader 5 (MT5) client definitions and wrapper classes.
 

Typedefs

using MT5::str = const std::string
 Alias for const std::string to simplify function signatures.
 
using MT5::VersionInfo = std::tuple< int32_t, int32_t, std::string >
 Tuple representing version info: <major version, minor version, build date string>.
 
using MT5::LastErrorResult = std::tuple< int32_t, std::string >
 Tuple representing the last error: <error code, error description>.
 
using MT5::DealsData = std::optional< std::vector< TradeDeal > >
 Optional vector of TradeDeal objects.
 
using MT5::SymbolsData = std::optional< std::vector< SymbolInfo > >
 Optional vector of SymbolInfo objects.
 
using MT5::BookData = std::optional< std::vector< BookInfo > >
 Optional vector of BookInfo (Market Depth) objects.
 
using MT5::OrdersData = std::optional< std::vector< TradeOrder > >
 Optional vector of TradeOrder objects.
 
using MT5::PositionsData = std::optional< std::vector< TradePosition > >
 Optional vector of TradePosition objects.
 
using MT5::RateInfoType = std::optional< py::array_t< RateInfo > >
 Optional Numpy array of RateInfo structures (OHLCV data).
 
using MT5::TickInfoType = std::optional< py::array_t< TickInfo > >
 Optional Numpy array of TickInfo structures.
 
using MT5::DateTime = std::chrono::system_clock::time_point
 System clock time point for date/time operations.
 
using MT5::InitializeAuto = std::function< bool()>
 Callback to initialize the MT5 terminal automatically.
 
using MT5::InitializeWithPath = std::function< bool(str &)>
 Callback to initialize the MT5 terminal with a specific path.
 
using MT5::InitializeFull = std::function< bool(str &, uint64_t, str &, str &, uint32_t, bool)>
 Callback to initialize the MT5 terminal with full configuration options.
 
using MT5::Login = std::function< bool(uint64_t, str &, str &, uint32_t)>
 Callback to login to an account.
 
using MT5::Shutdown = std::function< void()>
 Callback to shut down the initialized terminal.
 
using MT5::GetVersion = std::function< std::optional< VersionInfo >()>
 Callback to retrieve the terminal version.
 
using MT5::GetLastError = std::function< std::optional< LastErrorResult >()>
 Callback to retrieve the last error code and description.
 
using MT5::GetTerminalInfo = std::function< std::optional< TerminalInfo >()>
 Callback to retrieve static terminal information.
 
using MT5::GetAccountInfo = std::function< std::optional< AccountInfo >()>
 Callback to retrieve account information.
 
using MT5::GetSymbolInfo = std::function< std::optional< SymbolInfo >(str &)>
 Callback to retrieve information for a specific symbol.
 
using MT5::GetTickInfo = std::function< std::optional< TickInfo >(str &)>
 Callback to retrieve the last tick for a specific symbol.
 
using MT5::GetTotalSymbols = std::function< std::optional< int32_t >()>
 Callback to get the total count of available symbols.
 
using MT5::GetSymbolsAll = std::function< SymbolsData()>
 Callback to retrieve all available symbols.
 
using MT5::SelectSymbol = std::function< bool(str &, bool)>
 Callback to select or deselect a symbol in Market Watch.
 
using MT5::GetSymbolsByGroup = std::function< SymbolsData(str &)>
 Callback to retrieve symbols belonging to a specific group.
 
using MT5::SubscribeBook = std::function< bool(str &)>
 Callback to subscribe to the Market Book (Depth of Market) for a symbol.
 
using MT5::UnsubscribeBook = std::function< bool(str &)>
 Callback to unsubscribe from the Market Book for a symbol.
 
using MT5::GetBookInfo = std::function< BookData(str &)>
 Callback to get the current Market Book state for a symbol.
 
using MT5::GetRatesByDate = std::function< RateInfoType(str &, int32_t, int64_t, int32_t)>
 Callback to get rates starting from a specific date.
 
using MT5::GetRatesByPos = std::function< RateInfoType(str &, int32_t, int32_t, int32_t)>
 Callback to get rates starting from a specific index position.
 
using MT5::GetRatesByRange = std::function< RateInfoType(str &, int32_t, int64_t, int64_t)>
 Callback to get rates within a time range.
 
using MT5::GetTicksByDate = std::function< TickInfoType(str &, int64_t, int32_t, int32_t)>
 Callback to get ticks starting from a specific date.
 
using MT5::GetTicksByRange = std::function< TickInfoType(str &, int64_t, int64_t, int32_t)>
 Callback to get ticks within a time range.
 
using MT5::GetOrdersAll = std::function< OrdersData()>
 Callback to retrieve all current trade orders.
 
using MT5::GetOrdersBySymbol = std::function< OrdersData(str &)>
 Callback to retrieve trade orders filtered by symbol.
 
using MT5::GetOrdersByGroup = std::function< OrdersData(str &)>
 Callback to retrieve trade orders filtered by a specific group.
 
using MT5::GetOrderByTicket = std::function< std::optional< TradeOrder >(uint64_t)>
 Callback to retrieve a specific order by its unique ticket ID.
 
using MT5::GetTotalOrders = std::function< std::optional< int32_t >()>
 Callback to retrieve the total count of active orders.
 
using MT5::GetPositionsAll = std::function< PositionsData()>
 Callback to retrieve all active trade positions.
 
using MT5::GetPositionsBySymbol = std::function< PositionsData(str &)>
 Callback to retrieve active positions filtered by symbol.
 
using MT5::GetPositionsByGroup = std::function< PositionsData(str &)>
 Callback to retrieve active positions filtered by group.
 
using MT5::GetPositionByTicket = std::function< std::optional< TradePosition >(uint64_t)>
 Callback to retrieve a specific position by its unique ticket ID.
 
using MT5::GetTotalPositions = std::function< std::optional< int32_t >()>
 Callback to retrieve the total count of active positions.
 
using MT5::CalculateMargin = std::function< std::optional< double >(int32_t, str &, double, double)>
 Callback to calculate margin.
 
using MT5::CalculateProfit = std::function< std::optional< double >(int32_t, str &, double, double, double)>
 Callback to calculate profit.
 
using MT5::CheckOrder = std::function< std::optional< OrderCheckResult >(const TradeRequest &)>
 Callback to check an order request before sending.
 
using MT5::SendOrder = std::function< std::optional< OrderSentResult >(const TradeRequest &)>
 Callback to send an order to the market.
 
using MT5::GetHistoryOrdersByRange = std::function< OrdersData(int64_t, int64_t)>
 Callback to retrieve historical orders within a specific time range.
 
using MT5::GetHistoryOrdersByGroup = std::function< OrdersData(int64_t, int64_t, str &)>
 Callback to retrieve historical orders within a specific time range and filter.
 
using MT5::GetHistoryOrderByTicket = std::function< std::optional< TradeOrder >(uint64_t)>
 Callback to retrieve a specific historical order by its ticket ID.
 
using MT5::GetHistoryOrdersByPosId = std::function< OrdersData(uint64_t)>
 Callback to retrieve all historical orders associated with a specific Position ID.
 
using MT5::GetHistoryOrdersTotal = std::function< std::optional< int32_t >(int64_t, int64_t)>
 Callback to retrieve the total count of historical orders within a time range.
 
using MT5::GetHistoryDealsByRange = std::function< DealsData(int64_t, int64_t)>
 Callback to retrieve historical deals (executions) within a time range.
 
using MT5::GetHistoryDealsByGroup = std::function< DealsData(int64_t, int64_t, str &)>
 Callback to retrieve historical deals (executions) within a time range buy asset.
 
using MT5::GetHistoryDealsByTicket = std::function< DealsData(uint64_t)>
 Callback to retrieve historical deals associated with a specific Order Ticket.
 
using MT5::GetHistoryDealsByPosId = std::function< DealsData(uint64_t)>
 Callback to retrieve historical deals associated with a specific Position ID.
 
using MT5::GetHistoryDealsTotal = std::function< std::optional< int32_t >(int64_t, int64_t)>
 Callback to retrieve the total count of historical deals within a time range.
 

Detailed Description

Declares the public API for the Metatrader5 in the bbstrader library. This is the primary file that you should #include if you want to use the library.