diff --git a/fastlane_bot/bot.py b/fastlane_bot/bot.py index da83d65fc..50628e562 100644 --- a/fastlane_bot/bot.py +++ b/fastlane_bot/bot.py @@ -200,8 +200,9 @@ def get_curves(self) -> CPCContainer: f"[bot.get_curves] MUST FIX DECIMALS MISSING [{e}]\n" ) except Exception as e: + # TODO: unexpected Exception should possible raise self.ConfigObj.logger.error( - f"[bot.get_curves] error converting pool to curve {p}\n[ERR={e}]\n\n" + f"[bot.get_curves] MUST FIX UNEXPECTED ERROR converting pool to curve {p}\n[ERR={e}]\n\n" ) return CPCContainer(curves) @@ -816,8 +817,11 @@ def _handle_trade_instructions( r: Any ) -> Tuple[Optional[str], Optional[dict]]: """ - Handles the trade instructions. - + Creates and executes the trade instructions + + This is the workhorse function that chains all the different actions that + are necessary to create trade instructions and to ultimately execute them. + Parameters ---------- CCm: CPCContainer @@ -1166,13 +1170,13 @@ def run( Parameters ---------- flashloan_tokens: List[str] - The flashloan tokens (optional; default: self.RUN_FLASHLOAN_TOKENS) + The flashloan tokens (optional; default: RUN_FLASHLOAN_TOKENS) CCm: CPCContainer - The complete market data container (optional; default: database via self.get_curves()) + The complete market data container (optional; default: database via get_curves()) polling_interval: int - the polling interval in seconds (default: 60 via self.RUN_POLLING_INTERVAL) + the polling interval in seconds (default: 60 via RUN_POLLING_INTERVAL) arb_mode: str - the arbitrage mode (default: None) + the arbitrage mode (default: None; can be set depending on arbmode) run_data_validator: bool whether to run the data validator (default: False) randomizer: int @@ -1183,11 +1187,6 @@ def run( whether to run in replay mode (default: False) replay_from_block: int the block number to start replaying from (default: None) - - Returns - ------- - str - The transaction hash. """ self.setup_polling_interval(polling_interval) diff --git a/fastlane_bot/tests/test_039_TestMultiMode.py b/fastlane_bot/tests/test_039_TestMultiMode.py index 0b8a7ff8e..226915b24 100644 --- a/fastlane_bot/tests/test_039_TestMultiMode.py +++ b/fastlane_bot/tests/test_039_TestMultiMode.py @@ -124,8 +124,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "multi" diff --git a/fastlane_bot/tests/test_040_TestSingleMode.py b/fastlane_bot/tests/test_040_TestSingleMode.py index db6b531ee..c037ac0ef 100644 --- a/fastlane_bot/tests/test_040_TestSingleMode.py +++ b/fastlane_bot/tests/test_040_TestSingleMode.py @@ -125,8 +125,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "single" diff --git a/fastlane_bot/tests/test_042_TestBancorV3ModeTwoHop.py b/fastlane_bot/tests/test_042_TestBancorV3ModeTwoHop.py index 6c7aea057..5ea6a7dc3 100644 --- a/fastlane_bot/tests/test_042_TestBancorV3ModeTwoHop.py +++ b/fastlane_bot/tests/test_042_TestBancorV3ModeTwoHop.py @@ -126,8 +126,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "b3_two_hop" diff --git a/fastlane_bot/tests/test_043_TestEmptyCarbonOrders.py b/fastlane_bot/tests/test_043_TestEmptyCarbonOrders.py index 0037915a8..424f9a0eb 100644 --- a/fastlane_bot/tests/test_043_TestEmptyCarbonOrders.py +++ b/fastlane_bot/tests/test_043_TestEmptyCarbonOrders.py @@ -132,9 +132,9 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS -CCm = bot.setup_CCm(None) +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "multi" diff --git a/fastlane_bot/tests/test_045_Validator.py b/fastlane_bot/tests/test_045_Validator.py index e47bfe4a6..9c1b41a77 100644 --- a/fastlane_bot/tests/test_045_Validator.py +++ b/fastlane_bot/tests/test_045_Validator.py @@ -125,8 +125,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() diff --git a/fastlane_bot/tests/test_047_Randomizer.py b/fastlane_bot/tests/test_047_Randomizer.py index 5d91b9c1b..a170d0dd7 100644 --- a/fastlane_bot/tests/test_047_Randomizer.py +++ b/fastlane_bot/tests/test_047_Randomizer.py @@ -124,8 +124,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "multi" diff --git a/fastlane_bot/tests/test_050_TestBancorV2.py b/fastlane_bot/tests/test_050_TestBancorV2.py index 10f112277..a58b6f53d 100644 --- a/fastlane_bot/tests/test_050_TestBancorV2.py +++ b/fastlane_bot/tests/test_050_TestBancorV2.py @@ -127,8 +127,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "multi" diff --git a/fastlane_bot/tests/test_051_BalancerFlashloans.py b/fastlane_bot/tests/test_051_BalancerFlashloans.py index d071b77cd..9449bc1d1 100644 --- a/fastlane_bot/tests/test_051_BalancerFlashloans.py +++ b/fastlane_bot/tests/test_051_BalancerFlashloans.py @@ -129,8 +129,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "multi_pairwise" diff --git a/fastlane_bot/tests/test_058_BalancerIntegration.py b/fastlane_bot/tests/test_058_BalancerIntegration.py index 88194ddc4..ab5fde773 100644 --- a/fastlane_bot/tests/test_058_BalancerIntegration.py +++ b/fastlane_bot/tests/test_058_BalancerIntegration.py @@ -132,8 +132,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "multi_pairwise" diff --git a/fastlane_bot/tests/test_060_TestRoutehandlerCarbonPrecision.py b/fastlane_bot/tests/test_060_TestRoutehandlerCarbonPrecision.py index 10e9a4525..448c0a805 100644 --- a/fastlane_bot/tests/test_060_TestRoutehandlerCarbonPrecision.py +++ b/fastlane_bot/tests/test_060_TestRoutehandlerCarbonPrecision.py @@ -150,11 +150,11 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -#flashloan_tokens = bot.setup_flashloan_tokens(None) +#flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS #flashloan_tokens = ['WBTC-2c599', 'USDC-eB48', 'LINK-86CA', 'USDT-1ec7'] -CCm = bot.setup_CCm(None) +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() diff --git a/fastlane_bot/tests/test_061_TestWETHConversion.py b/fastlane_bot/tests/test_061_TestWETHConversion.py index e1b969e29..e37f5d8c1 100644 --- a/fastlane_bot/tests/test_061_TestWETHConversion.py +++ b/fastlane_bot/tests/test_061_TestWETHConversion.py @@ -156,11 +156,11 @@ def init_bot(mgr: Manager) -> CarbonBot: # bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -# flashloan_tokens = bot.setup_flashloan_tokens(None) +# flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS # flashloan_tokens = ['WBTC-2c599', 'USDC-eB48', 'LINK-86CA', 'USDT-1ec7'] -CCm = bot.setup_CCm(None) +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() # - diff --git a/fastlane_bot/tests/test_063_TestBancorPOLMode.py b/fastlane_bot/tests/test_063_TestBancorPOLMode.py index 1088e0772..da6121a54 100644 --- a/fastlane_bot/tests/test_063_TestBancorPOLMode.py +++ b/fastlane_bot/tests/test_063_TestBancorPOLMode.py @@ -124,8 +124,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "multi_pairwise_pol" diff --git a/fastlane_bot/tests/test_064_TestMultiAllMode.py b/fastlane_bot/tests/test_064_TestMultiAllMode.py index 490ea6202..fecafdcbb 100644 --- a/fastlane_bot/tests/test_064_TestMultiAllMode.py +++ b/fastlane_bot/tests/test_064_TestMultiAllMode.py @@ -124,8 +124,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "multi_pairwise_all" diff --git a/fastlane_bot/tests/test_901_TestMultiTriangleModeSlow.py b/fastlane_bot/tests/test_901_TestMultiTriangleModeSlow.py index 5c0c6355d..f81e971c4 100644 --- a/fastlane_bot/tests/test_901_TestMultiTriangleModeSlow.py +++ b/fastlane_bot/tests/test_901_TestMultiTriangleModeSlow.py @@ -125,8 +125,8 @@ def init_bot(mgr: Manager) -> CarbonBot: bot.db.remove_unsupported_exchanges() tokens = bot.db.get_tokens() ADDRDEC = {t.address: (t.address, int(t.decimals)) for t in tokens if not math.isnan(t.decimals)} -flashloan_tokens = bot.setup_flashloan_tokens(None) -CCm = bot.setup_CCm(None) +flashloan_tokens = bot.RUN_FLASHLOAN_TOKENS +CCm = bot.get_curves() pools = db.get_pool_data_with_tokens() arb_mode = "multi_triangle"