From 969882c4731791902b7dee748a17f5bf84fa3e54 Mon Sep 17 00:00:00 2001 From: Lesigh-3100 Date: Tue, 18 Jun 2024 16:48:13 +0300 Subject: [PATCH] Remove multi triangle complete --- fastlane_bot/bot.py | 2 - fastlane_bot/modes/triangle_multi_complete.py | 83 ------------------- main.py | 1 - 3 files changed, 86 deletions(-) delete mode 100644 fastlane_bot/modes/triangle_multi_complete.py diff --git a/fastlane_bot/bot.py b/fastlane_bot/bot.py index 31090b8c5..5fe5800d5 100644 --- a/fastlane_bot/bot.py +++ b/fastlane_bot/bot.py @@ -74,7 +74,6 @@ from .modes.pairwise_multi_pol import FindArbitrageMultiPairwisePol from .modes.pairwise_single import FindArbitrageSinglePairwise from .modes.triangle_multi import ArbitrageFinderTriangleMulti -from .modes.triangle_multi_complete import ArbitrageFinderTriangleMultiComplete from .modes.triangle_single import ArbitrageFinderTriangleSingle from .modes.triangle_bancor_v3_two_hop import ArbitrageFinderTriangleBancor3TwoHop from .utils import num_format @@ -110,7 +109,6 @@ class CarbonBot: "b3_two_hop": ArbitrageFinderTriangleBancor3TwoHop, "multi_pairwise_pol": FindArbitrageMultiPairwisePol, "multi_pairwise_all": FindArbitrageMultiPairwiseAll, - "multi_triangle_complete": ArbitrageFinderTriangleMultiComplete, } class NoArbAvailable(Exception): diff --git a/fastlane_bot/modes/triangle_multi_complete.py b/fastlane_bot/modes/triangle_multi_complete.py deleted file mode 100644 index d053ae0fc..000000000 --- a/fastlane_bot/modes/triangle_multi_complete.py +++ /dev/null @@ -1,83 +0,0 @@ -""" -Defines the Triangular arbitrage finder class - -[DOC-TODO-OPTIONAL-longer description in rst format] - ---- -(c) Copyright Bprotocol foundation 2023-24. -All rights reserved. -Licensed under MIT. -""" -from typing import List, Any, Tuple, Union - -from fastlane_bot.modes.base_triangle import ArbitrageFinderTriangleBase -from fastlane_bot.tools.cpc import CPCContainer -from fastlane_bot.tools.optimizer import MargPOptimizer - - -class ArbitrageFinderTriangleMultiComplete(ArbitrageFinderTriangleBase): - """ - Triangular arbitrage finder mode - """ - - arb_mode = "multi_triangle_complete" - - def find_arbitrage(self, candidates: List[Any] = None, ops: Tuple = None, best_profit: float = 0, profit_src: float = 0) -> Union[List, Tuple]: - """ - see base.py - """ - - if candidates is None: - candidates = [] - - combos = self.get_comprehensive_triangles(self.flashloan_tokens, self.CCm) - - for src_token, miniverse in combos: - try: - CC_cc = CPCContainer(miniverse) - O = MargPOptimizer(CC_cc) - pstart = self.build_pstart(CC_cc, CC_cc.tokens(), src_token) - r = O.optimize(src_token, params=dict(pstart=pstart)) - trade_instructions_dic = r.trade_instructions(O.TIF_DICTS) - if trade_instructions_dic is None or len(trade_instructions_dic) < 3: - # Failed to converge - continue - trade_instructions_df = r.trade_instructions(O.TIF_DFAGGR) - trade_instructions = r.trade_instructions() - - except Exception as e: - self.ConfigObj.logger.info(f"[triangle multi] {e}") - continue - profit_src = -r.result - - # Get the cids - cids = [ti["cid"] for ti in trade_instructions_dic] - - # Calculate the profit - profit = self.calculate_profit(src_token, profit_src, self.CCm, cids) - if str(profit) == "nan": - self.ConfigObj.logger.debug("profit is nan, skipping") - continue - - # Handle candidates based on conditions - candidates += self.handle_candidates( - best_profit, - profit, - trade_instructions_df, - trade_instructions_dic, - src_token, - trade_instructions, - ) - - # Find the best operations - best_profit, ops = self.find_best_operations( - best_profit, - ops, - profit, - trade_instructions_df, - trade_instructions_dic, - src_token, - trade_instructions, - ) - - return candidates if self.result == self.AO_CANDIDATES else ops diff --git a/main.py b/main.py index fba6b7563..3ea30ad73 100644 --- a/main.py +++ b/main.py @@ -592,7 +592,6 @@ def run(mgr, args, tenderly_uri=None) -> None: "b3_two_hop", "multi_pairwise_pol", "multi_pairwise_all", - "multi_triangle_complete" ], ) parser.add_argument(