Arbitrage Executor - Hummingbot
URL: https://hummingbot.org/v2-strategies/executors/arbitrage-executor/
Contents:
- Arbitrage Executor
- Workflow¶
- Sample Script¶
ArbitrageExecutor: Specialized in controlling profitability between two markets, such as between centralized exchanges (CEX) and decentralized exchanges (DEX), optimizing for arbitrage opportunities.
The ArbitrageExecutor class is a specialized component within Hummingbot designed for capitalizing on price discrepancies between different markets or exchanges by automating the process of simultaneously executes buy and sell orders on two distinct markets, aiming to exploit arbitrage opportunities for profit.
Upon initialization, the ArbitrageExecutor performs the following actions:
Below, we show code snippets from the Arbitrage with Smart Component script, which provides an example of how to use the ArbitrageExecutor.
You can define the two markets to arbitrage, the order amount, and the arbitrage profitability threshold.
The create_arbitrage_executor method is responsible for creating a new ArbitrageExecutor. First, it checks available balances on the buying and selling exchanges to ensure there's enough capital to execute the arbitrage. If so, it creates ArbitrageExecutor instances based on the settings above.
Examples:
Example 1 (unknown):
class ArbitrageWithSmartComponent(ScriptStrategyBase):
# Parameters
exchange_pair_1 = ExchangePair(exchange="binance", trading_pair="MATIC-USDT")
exchange_pair_2 = ExchangePair(exchange="uniswap_polygon_mainnet", trading_pair="WMATIC-USDT")
order_amount = Decimal("50") # in base asset
min_profitability = Decimal("0.004")Example 2 (python):
def create_arbitrage_executor(self, buying_exchange_pair: ExchangePair, selling_exchange_pair: ExchangePair):
...
arbitrage_config = ArbitrageConfig(
buying_market=buying_exchange_pair,
selling_market=selling_exchange_pair,
order_amount=self.order_amount,
min_profitability=self.min_profitability,
)