### PyTrader Open Orders & Positions Retrieval Source: https://github.com/thesnowguru/pytrader-python-mt4-mt5-trading-api-connector-drag-n-drop/blob/master/Older versions/README.md Fetches lists of all currently open orders and positions associated with the trading account from the MT5 terminal. ```APIDOC PyTrader Open Orders: get_all_open_orders() - Retrieves a list of all pending orders currently active on the account. - Returns: List of dictionaries, where each dictionary represents an order. PyTrader Open Positions: get_all_open_positions() - Retrieves a list of all currently open positions on the account. - Returns: List of dictionaries, where each dictionary represents a position. ``` -------------------------------- ### PyTrader Account & Instrument Data Retrieval Source: https://github.com/thesnowguru/pytrader-python-mt4-mt5-trading-api-connector-drag-n-drop/blob/master/Older versions/README.md Functions to retrieve various account-specific details, static instrument properties, and real-time tick data from the MT5 terminal. ```APIDOC PyTrader Account Information: get_account_info_static() - Retrieves static account information (e.g., account number, leverage). - Returns: Dictionary containing static account details. get_account_info_dynamic() - Retrieves dynamic account information (e.g., balance, equity, margin, free margin). - Returns: Dictionary containing dynamic account metrics. PyTrader Instrument Information: get_instrument_info(symbol: str) - Retrieves instrument-specific details like pip value, lot size limits, tick size, and tick value. - Parameters: - symbol: The trading symbol (e.g., 'EURUSD'). - Returns: Dictionary with instrument properties. PyTrader Tick Data: get_last_tick(symbol: str) - Fetches the most recent tick data for a given symbol. - Parameters: - symbol: The trading symbol. - Returns: Dictionary containing tick data (date, bid, ask, last, volume). get_last_ticks_array(symbol: str, count: int) - Retrieves an array of the last 'count' ticks for a symbol. - Parameters: - symbol: The trading symbol. - count: The number of ticks to retrieve. - Returns: List of tick data dictionaries. ``` -------------------------------- ### PyTrader Execution Information Source: https://github.com/thesnowguru/pytrader-python-mt4-mt5-trading-api-connector-drag-n-drop/blob/master/Older versions/README.md Provides feedback on the execution of trading operations, such as order fills or trade confirmations, from the MT5 terminal to the Python client. ```APIDOC PyTrader Execution Feedback: get_execution_info() - Retrieves information about the last executed trade or order fill. - This function is typically called after an order placement or modification to confirm the outcome. - Returns: Dictionary containing execution details (e.g., order ID, ticket, price, volume, type, comment). ``` -------------------------------- ### PyTrader Order & Position Management Source: https://github.com/thesnowguru/pytrader-python-mt4-mt5-trading-api-connector-drag-n-drop/blob/master/Older versions/README.md Handles the creation, modification, cancellation, and closing of trading orders and positions within the MT5 terminal. ```APIDOC PyTrader Order Placement: open_order(symbol: str, order_type: str, volume: float, price: float = None, sl: float = None, tp: float = None, comment: str = '') - Opens a new trading order (e.g., BUY, SELL, BUY_LIMIT). - Parameters: - symbol: The trading symbol. - order_type: Type of order (e.g., 'BUY', 'SELL', 'BUY_LIMIT', 'SELL_STOP'). - volume: The volume of the trade. - price: The execution price (for market orders, this can be None). - sl: Stop Loss price. - tp: Take Profit price. - comment: Optional comment for the order. - Returns: Order placement confirmation or error details. PyTrader Order Modification: modify_order(order_id: int, sl: float = None, tp: float = None, price: float = None) - Modifies an existing order (e.g., changes Stop Loss, Take Profit, or price). - Parameters: - order_id: The unique identifier of the order. - sl: New Stop Loss price. - tp: New Take Profit price. - price: New price for pending orders. - Returns: Modification status. PyTrader Order Cancellation: cancel_order(order_id: int) - Cancels a pending order. - Parameters: - order_id: The unique identifier of the order to cancel. - Returns: Cancellation status. PyTrader Position Management: close_position(position_id: int, volume: float = None) - Closes an open position. - Parameters: - position_id: The unique identifier of the position. - volume: The volume to close (defaults to closing the entire position). - Returns: Closing status. partly_close_position(position_id: int, volume: float) - Closes a portion of an open position. - Parameters: - position_id: The unique identifier of the position. - volume: The volume to close. - Returns: Partial closing status. ``` -------------------------------- ### PyTrader Core Connection & Login Source: https://github.com/thesnowguru/pytrader-python-mt4-mt5-trading-api-connector-drag-n-drop/blob/master/Older versions/README.md Establishes and maintains a connection between a Python client and the MT4/MT5 terminal via a WebSocket server (EA). Includes login and keep-alive functionalities. ```APIDOC PyTrader Connection Management: login(server_address: str, port: int, username: str, password: str, broker: str) - Establishes a WebSocket connection to the MT4/MT5 EA server. - Parameters: - server_address: The IP address or hostname of the server running the EA. - port: The port number the EA is listening on. - username: Trading account username. - password: Trading account password. - broker: The name of the broker. - Returns: Connection status or object. keep_alive() - Sends a heartbeat signal to maintain the WebSocket connection. - Ensures the connection remains active and prevents timeouts. - Returns: Status of the keep-alive signal. ``` -------------------------------- ### PyTrader Bar Data Retrieval Source: https://github.com/thesnowguru/pytrader-python-mt4-mt5-trading-api-connector-drag-n-drop/blob/master/Older versions/README.md Fetches historical bar data (OHLCV) for specified symbols and timeframes, including recent bars and arrays of bars. ```APIDOC PyTrader Bar Data: get_last_bar(symbol: str, timeframe: str) - Retrieves the most recent completed bar's data for a symbol and timeframe. - Parameters: - symbol: The trading symbol. - timeframe: The chart timeframe (e.g., 'M1', 'H1', 'D1'). - Returns: Dictionary containing bar data (date, open, high, low, close, volume). get_last_bars_array(symbol: str, timeframe: str, count: int) - Retrieves an array of the last 'count' completed bars for a symbol and timeframe. - Parameters: - symbol: The trading symbol. - timeframe: The chart timeframe. - count: The number of bars to retrieve. - Returns: List of bar data dictionaries. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.