Skip to content

XEMM Executor

The XEMMExecutor is an implementation of a Cross-Exchange Market Making (XEMM) execution strategy within the Hummingbot trading framework. This strategy exploits price discrepancies between different exchanges (or different markets within the same exchange) by simultaneously buying and selling equivalent assets to capture arbitrage opportunities. Below is an overview of the key components and functionalities of the XEMMExecutor class:

Key Components:

Class Inheritance and Initialization: The XEMMExecutor class inherits from ExecutorBase, indicating it's a specialized form of executor tailored for XEMM operations. It initializes with a strategy, configuration, update interval, and maximum retries.

Logging: Utilizes Hummingbot's logging mechanism for recording detailed information, warnings, and errors.

Configuration and Validation: Accepts a XEMMExecutorConfig object as configuration, which outlines the parameters for the XEMM strategy such as buying and selling markets, trading pairs, and the side of the market making (maker). It validates whether the trading pairs across the exchanges are interchangeable for arbitrage purposes.

Order Management: - Validates sufficient balance before initiating trades. - Dynamically manages and updates maker and taker orders based on profitability and market conditions. - Responds to order lifecycle events like creation, completion, and failure, ensuring robust handling and recovery from unexpected market movements.

Control Task: An asynchronous control task (control_task) that manages order creation, price updates, and the shutdown process, ensuring that operations adhere to the strategy’s parameters.

Arbitrage Validation: Ensures that the configured trading pairs are suitable for arbitrage, checking token interchangeability and market conditions.

Profitability Calculations: Computes and updates transaction costs, target prices, and profitability thresholds to make real-time trading decisions.

Key Functions:

  • _are_tokens_interchangeable: Checks if two tokens can be considered equivalent for trading, which is crucial for identifying valid arbitrage opportunities.

  • validate_sufficient_balance: Ensures there is enough balance to place the initial orders.

  • control_task: Oversees the entire trading operation, including updating prices, managing orders, and handling executor shutdown.

  • create_maker_order and control_update_maker_order: Manage the lifecycle of the maker order based on current market prices and order status.

  • Event Handling Methods: Includes process_order_created_event, process_order_failed_event, and process_order_completed_event to manage responses to specific order-related events.

Conclusion:

The XEMMExecutor class is crafted to facilitate automated trading that capitalizes on price inefficiencies across different trading venues. It incorporates sophisticated logic for real-time decision-making, order management, and profitability calculation, making it a vital component of the Hummingbot framework for advanced arbitrage strategies.