Skip to main content
Glama

metatrader-mcp-server

check_margin_level.py934 B
import logging from ..exceptions import MarginLevelError, AccountInfoError, ConnectionError from .get_margin_level import get_margin_level logger = logging.getLogger("MT5Account") def check_margin_level(connection, min_level: float = 100.0) -> bool: """ Check if margin level is above the specified minimum level. Args: min_level: Minimum margin level in percentage (default: 100.0). Returns: bool: True if margin level is above the minimum, False otherwise. Raises: MarginLevelError: If margin level is below the minimum. AccountInfoError: If margin level cannot be retrieved. ConnectionError: If not connected to terminal. """ margin_level = get_margin_level(connection) if margin_level < min_level: msg = f"Margin level too low: {margin_level}% (minimum: {min_level}%)" logger.warning(msg) raise MarginLevelError(msg) return True

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