MT5Service API Reference¶
Layer 2 (Mid-Level API) - Wrapper methods with enhanced error handling and convenience
Source: src/main/java/io/metarpc/mt5/MT5Service.java
Account Information Helpers¶
getBalance()- Get account balancegetEquity()- Get account equitygetMargin()- Get used margingetFreeMargin()- Get free margingetProfit()- Get current floating profit/loss
Position & Order Helpers¶
positionsTotal()- Get count of open positionsopenedOrders(sortType)- Get all positions and ordersopenedOrdersTickets()- Get only ticket numbersorderHistory(from, to, sortType, offset, limit)- Get orders historypositionsHistory(from, to, sortType, offset, limit)- Get positions history
Trading Wrappers¶
orderSend(request)- Place order with enhanced error handlingorderCheck(request)- Validate order before placingorderModify(request)- Modify position/orderorderClose(request)- Close positionorderCalcMargin(...)- Calculate marginorderCalcProfit(...)- Calculate profit
Symbol Information Wrappers¶
symbolInfoTick(symbol)- Get current ticksymbolInfoDouble(symbol, property)- Get double propertysymbolInfoInteger(symbol, property)- Get integer propertysymbolInfoString(symbol, property)- Get string propertysymbolSelect(symbol, select)- Enable/disable symbolsymbolsTotal(selectedOnly)- Get symbols count
Market Depth Wrappers¶
marketBookAdd(symbol)- Subscribe to DOMmarketBookGet(symbol)- Get DOM datamarketBookRelease(symbol)- Unsubscribe from DOM
Streaming Subscriptions¶
onSymbolTick(symbols[], observer)- Subscribe to ticksonTrade(observer)- Subscribe to tradesonPositionProfit(period, ignoreEmpty, observer)- Subscribe to P/L updatesonPositionsAndPendingOrdersTickets(period, observer)- Subscribe to ticketsonTradeTransaction(observer)- Subscribe to transactions
Key Differences from MT5Account: - Enhanced error messages - Convenient overloaded methods - Automatic type conversions - Better default parameters
Note: MT5Service wraps MT5Account and provides the same functionality with improved usability.
For detailed documentation with examples, see MT5Account documentation.