Skip to main content
Glama

metatrader-mcp-server

get_trade_statistics.py1.34 kB
from typing import Dict, Any from ..exceptions import AccountInfoError, ConnectionError from .get_account_info import get_account_info from .get_account_type import get_account_type def get_trade_statistics(connection) -> Dict[str, Any]: """ Get basic trade statistics for the account. Returns: Dict[str, Any]: Dictionary with trade statistics: - balance: Current balance - equity: Current equity - profit: Current floating profit/loss - margin_level: Current margin level - free_margin: Available margin for trading - account_type: Account type (real, demo, contest) - leverage: Account leverage - currency: Account currency Raises: AccountInfoError: If statistics cannot be retrieved. ConnectionError: If not connected to terminal. """ account_info = get_account_info(connection) stats = { "balance": account_info["balance"], "equity": account_info["equity"], "profit": account_info["profit"], "margin_level": account_info["margin_level"], "free_margin": account_info["margin_free"], "account_type": get_account_type(connection), "leverage": account_info["leverage"], "currency": account_info["currency"], } return stats

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ariadng/metatrader-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server