Skip to content
All library documents

Cross-Exchange Market Making with Dynamic Maker and Taker Orders

Article Hummingbot docs

Summary

This overview describes an automated cross-exchange market-making executor in the Hummingbot framework. The strategy seeks to capture price differences between venues or markets by placing a maker order on one side and executing against a taker market when conditions meet profitability requirements. Its setup includes exchange and trading-pair configuration, maker-side selection, token-equivalence checks, balance validation, and calculations for costs, target prices, and profit thresholds.

An asynchronous control process updates prices, manages order creation and cancellation, and handles completion or failure events, including recovery from unexpected market changes. The document is a component-level description rather than a tested strategy report: it gives no implementation details for the calculations, empirical results, or quantified risk analysis. Token interchangeability, fees, slippage, and execution timing are central practical constraints, but the overview does not explain how they are measured or controlled.

Key ideas

  • Cross-exchange market making aims to exploit price differences by combining maker and taker orders across venues.
  • The executor validates that configured trading pairs represent interchangeable assets and that balances are sufficient.
  • A control process updates prices and manages order lifecycles, including failed and completed orders.
  • Profitability decisions account for transaction costs and target thresholds, though the document does not specify their formulas or report performance.

Tags

Full text
# 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.

Shown in full with attribution under the source's licence. Licence: Apache-2.0

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.