Skip to content

Commit

Permalink
fixing broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewcasale committed Dec 10, 2023
1 parent 07c640c commit 682fe9b
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 297 deletions.
184 changes: 76 additions & 108 deletions resources/NBTest/NBTest_903_FlashloanTokens.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,45 @@
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 1,
"id": "initial_id",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-06T14:24:22.696066Z",
"start_time": "2023-12-06T14:24:22.674355Z"
"end_time": "2023-12-10T19:05:13.573427Z",
"start_time": "2023-12-10T19:05:12.661409Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Python-dotenv could not parse statement starting at line 3\n",
"Python-dotenv could not parse statement starting at line 4\n",
"Python-dotenv could not parse statement starting at line 5\n",
"Python-dotenv could not parse statement starting at line 6\n",
"Python-dotenv could not parse statement starting at line 3\n",
"Python-dotenv could not parse statement starting at line 4\n",
"Python-dotenv could not parse statement starting at line 5\n",
"Python-dotenv could not parse statement starting at line 6\n",
"Python-dotenv could not parse statement starting at line 3\n",
"Python-dotenv could not parse statement starting at line 4\n",
"Python-dotenv could not parse statement starting at line 5\n",
"Python-dotenv could not parse statement starting at line 6\n",
"Python-dotenv could not parse statement starting at line 3\n",
"Python-dotenv could not parse statement starting at line 4\n",
"Python-dotenv could not parse statement starting at line 5\n",
"Python-dotenv could not parse statement starting at line 6\n",
"Python-dotenv could not parse statement starting at line 3\n",
"Python-dotenv could not parse statement starting at line 4\n",
"Python-dotenv could not parse statement starting at line 5\n",
"Python-dotenv could not parse statement starting at line 6\n",
"Python-dotenv could not parse statement starting at line 3\n",
"Python-dotenv could not parse statement starting at line 4\n",
"Python-dotenv could not parse statement starting at line 5\n",
"Python-dotenv could not parse statement starting at line 6\n"
]
},
{
"name": "stdout",
"output_type": "stream",
Expand All @@ -22,6 +52,7 @@
"SushiswapV2 v0.0.2 (2023-08-27)\n",
"CarbonV1 v0.0.2 (2023-08-27)\n",
"BancorV3 v0.0.2 (2023-08-27)\n",
"imported m, np, pd, plt, os, sys, decimal; defined iseq, raises, require\n",
"Version = 3-b2.2 [requirements >= 3.0 is met]\n"
]
}
Expand Down Expand Up @@ -59,12 +90,12 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 2,
"id": "1640a40ee6ae871c",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-06T14:24:22.704926Z",
"start_time": "2023-12-06T14:24:22.680216Z"
"end_time": "2023-12-10T19:05:13.577681Z",
"start_time": "2023-12-10T19:05:13.575584Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -109,15 +140,15 @@
" # \"--use_cached_events=True\",\n",
" \"--alchemy_max_block_fetch=5\",\n",
" \"--logging_path=fastlane_bot/data/\",\n",
" \"--timeout=80\",\n",
" \"--timeout=120\",\n",
" \"--blockchain=ethereum\"\n",
" ]\n",
" subprocess.Popen(cmd)\n",
" \n",
" # Wait for the expected log line to appear\n",
" expected_log_line = \"limiting flashloan_tokens to [\"\n",
" found = False\n",
" result = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=120)\n",
" result = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=180)\n",
"\n",
" # Check if the expected log line is in the output\n",
" if expected_log_line in result.stderr:\n",
Expand All @@ -137,13 +168,13 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "c6e198d0eeba3183",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-06T14:26:18.038890Z",
"start_time": "2023-12-06T14:24:22.682802Z"
}
"start_time": "2023-12-10T19:05:13.577411Z"
},
"is_executing": true
},
"outputs": [
{
Expand Down Expand Up @@ -190,23 +221,28 @@
"Python-dotenv could not parse statement starting at line 4\n",
"Python-dotenv could not parse statement starting at line 5\n",
"Python-dotenv could not parse statement starting at line 6\n",
"2023-12-06 06:24:24,365 [fastlane:INFO] - \n",
"2023-12-06 06:24:24,365 [fastlane:INFO] - **********************************************\n",
"2023-12-06 06:24:24,365 [fastlane:INFO] - The logging path is set to: fastlane_bot/data//logs/20231206-062424/bot.log\n",
"2023-12-06 06:24:24,365 [fastlane:INFO] - **********************************************\n",
"2023-12-06 06:24:24,365 [fastlane:INFO] - \n",
"2023-12-06 06:24:24,994 [fastlane:INFO] - Using mainnet config\n",
"2023-12-06 06:24:25,016 [fastlane:INFO] - tokens: 22219, USDC-eB48\n",
"2023-12-06 06:24:25,017 [fastlane:INFO] - unique_tokens: 22219\n",
"2023-12-06 06:24:25,024 [fastlane:INFO] - Flashloan tokens are set as: ['BNT-FF1C', 'WETH-6Cc2', 'USDC-eB48', 'USDT-1ec7', 'LINK-86CA'], <class 'list'>\n",
"2023-12-06 06:24:25,024 [fastlane:INFO] - Running data fetching for exchanges: ['carbon_v1', 'bancor_v3', 'bancor_v2', 'bancor_pol', 'uniswap_v3', 'uniswap_v2', 'sushiswap_v2', 'balancer', 'pancakeswap_v2', 'pancakeswap_v3']\n",
"2023-12-06 06:24:25,024 [fastlane:INFO] - \n",
"2023-12-10 11:05:14,786 [fastlane:INFO] - \n",
"2023-12-10 11:05:14,786 [fastlane:INFO] - **********************************************\n",
"2023-12-10 11:05:14,786 [fastlane:INFO] - The logging path is set to: fastlane_bot/data//logs/20231210-110514/bot.log\n",
"2023-12-10 11:05:14,786 [fastlane:INFO] - **********************************************\n",
"2023-12-10 11:05:14,786 [fastlane:INFO] - \n",
"2023-12-10 11:05:16,566 [fastlane:INFO] - [events.utils.get_config] Using mainnet config\n",
"2023-12-10 11:05:16,587 [fastlane:INFO] - tokens: 22225, USDC-eB48\n",
"2023-12-10 11:05:16,588 [fastlane:INFO] - [events.utils.handle_flashloan_tokens] unique_tokens: 22225\n",
"2023-12-10 11:05:16,595 [fastlane:INFO] - [events.utils.handle_flashloan_tokens] Flashloan tokens are set as: ['BNT-FF1C', 'WETH-6Cc2', 'USDC-eB48', 'USDT-1ec7', 'LINK-86CA'], <class 'list'>\n",
"2023-12-10 11:05:16,596 [fastlane:INFO] - [events.utils] Running data fetching for exchanges: ['carbon_v1', 'bancor_v3', 'bancor_v2', 'bancor_pol', 'uniswap_v3', 'uniswap_v2', 'sushiswap_v2', 'balancer', 'pancakeswap_v2', 'pancakeswap_v3']\n",
"2023-12-10 11:05:16,596 [fastlane:INFO] - \n",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
" \n",
" Starting fastlane bot with the following configuration:\n",
" bot_version: 2.7.78\n",
" os_system: Darwin\n",
" python_version: 3.8.18 (default, Sep 11 2023, 08:17:16) \n",
"[Clang 14.0.6 ]\n",
" python_info: sys.version_info(major=3, minor=8, micro=18, releaselevel='final', serial=0)\n",
" \n",
" logging_path: fastlane_bot/data/logs/20231206-062424\n",
" logging_path: fastlane_bot/data/logs/20231210-110514\n",
" arb_mode: b3_two_hop\n",
" blockchain: ethereum\n",
" default_min_profit_gas_token: 60\n",
Expand Down Expand Up @@ -240,90 +276,22 @@
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
" \n",
"2023-12-06 06:24:25,757 [fastlane:INFO] - Retrieved 214 carbon pairs from contract\n",
"2023-12-06 06:24:27,868 [fastlane:INFO] - Time taken to add initial pools: 0.028343915939331055\n",
"2023-12-06 06:24:28,194 [fastlane:INFO] - Adding 286307 uniswap_v2 pools to static pools\n",
"2023-12-06 06:24:28,199 [fastlane:INFO] - Adding 3861 sushiswap_v2 pools to static pools\n",
"2023-12-06 06:24:28,205 [fastlane:INFO] - Adding 472 pancakeswap_v2 pools to static pools\n",
"2023-12-06 06:24:28,214 [fastlane:INFO] - Adding 286307 uniswap_v2 pools to static pools\n",
"2023-12-06 06:24:28,221 [fastlane:INFO] - Adding 17983 uniswap_v3 pools to static pools\n",
"2023-12-06 06:24:28,228 [fastlane:INFO] - Adding 158 pancakeswap_v3 pools to static pools\n",
"2023-12-06 06:24:28,519 [fastlane:INFO] - Fetching events from 18727856 to 18727861... 0\n",
"2023-12-06 06:24:31,827 [fastlane:INFO] - Found 184 new events, 82 carbon_pol_events\n",
"2023-12-06 06:24:31,829 [fastlane:INFO] - Saved events to fastlane_bot/data/logs/20231206-062424/latest_event_data.json\n",
"2023-12-06 06:24:39,415 [fastlane:INFO] - Adding new token Lisa-cb88 to fastlane_bot/data/blockchain_data/ethereum/tokens.csv\n",
"2023-12-06 06:24:40,342 [fastlane:INFO] - Adding new token MIND-f8aB to fastlane_bot/data/blockchain_data/ethereum/tokens.csv\n",
"2023-12-06 06:24:40,580 [fastlane:INFO] - Adding new token BBOX-3631 to fastlane_bot/data/blockchain_data/ethereum/tokens.csv\n",
"2023-12-06 06:24:44,901 [fastlane:INFO] - Updating carbon pools w/ multicall...\n",
"2023-12-06 06:24:45,160 [fastlane:INFO] - Retrieved 214 carbon pairs from contract\n",
"2023-12-06 06:24:45,160 [fastlane:INFO] - Retrieving carbon strategies from contract\n",
"2023-12-06 06:24:47,684 [fastlane:INFO] - Carbon is initialized True\n",
"2023-12-06 06:24:47,684 [fastlane:INFO] - Retrieved 214 carbon strategies\n",
"2023-12-06 06:24:47,685 [fastlane:INFO] - Setting carbon fee pairs...\n",
"2023-12-06 06:24:49,759 [fastlane:INFO] - Fetched 413 carbon strategies in 4.858100891113281 seconds\n",
"2023-12-06 06:24:49,818 [fastlane:INFO] - Updated 413 carbon strategies info in 0.05879092216491699 seconds\n",
"2023-12-06 06:25:15,493 [fastlane:INFO] - Initializing the bot...\n",
"2023-12-06 06:25:15,621 [fastlane:INFO] - State has changed...\n",
"2023-12-06 06:25:27,649 [fastlane:INFO] - \n",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
" \n",
" Finished first iteration of data sync. Now starting main loop arbitrage search.\n",
" \n",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
" \n",
"2023-12-06 06:25:27,881 [fastlane:INFO] - Checking latest version of Arbitrage Contract. Found version: 9\n",
"2023-12-06 06:25:28,360 [fastlane:INFO] - Fetching events from 18727859 to 18727866... 18727861\n",
"2023-12-06 06:25:30,650 [fastlane:INFO] - Found 191 new events, 82 carbon_pol_events\n",
"2023-12-06 06:25:30,651 [fastlane:INFO] - Saved events to fastlane_bot/data/logs/20231206-062424/latest_event_data.json\n",
"2023-12-06 06:25:31,961 [fastlane:INFO] - Adding new token POJAK-66EF to fastlane_bot/data/blockchain_data/ethereum/tokens.csv\n",
"2023-12-06 06:25:34,311 [fastlane:INFO] - Adding new token POLY-D1eC to fastlane_bot/data/blockchain_data/ethereum/tokens.csv\n",
"2023-12-06 06:26:01,494 [fastlane:INFO] - Initializing the bot...\n",
"2023-12-06 06:26:01,620 [fastlane:INFO] - State has changed...\n",
"2023-12-06 06:26:01,717 [fastlane:INFO] - Updated token data with 2 new tokens\n",
"2023-12-06 06:26:01,719 [fastlane:INFO] - Removed 0 unmapped uniswap_v2/sushi pools. 1733 uniswap_v2/sushi pools remaining\n",
"2023-12-06 06:26:01,719 [fastlane:INFO] - Unmapped uniswap_v2/sushi pools:\n",
"2023-12-06 06:26:01,741 [fastlane:INFO] - uniswap_v2: 0\n",
"2023-12-06 06:26:01,741 [fastlane:INFO] - sushiswap_v2: 0\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - uniswap_v3: 51\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - sushiswap_v2: 7\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - uniswap_v2: 90\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - bancor_v2: 0\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - bancor_v3: 13\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - bancor_pol: 72\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - carbon_v1: 184\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - pancakeswap_v2: 0\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - pancakeswap_v3: 2\n",
"2023-12-06 06:26:01,742 [fastlane:INFO] - balancer: 62\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - uniswap_v3_zero_liquidity_pools: 188\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - sushiswap_v2_zero_liquidity_pools: 74\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - uniswap_v2_zero_liquidity_pools: 101\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - bancor_v2_zero_liquidity_pools: 95\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - bancor_v3_zero_liquidity_pools: 1\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - bancor_pol_zero_liquidity_pools: 10\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - carbon_v1_zero_liquidity_pools: 229\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - pancakeswap_v2_zero_liquidity_pools: 430\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - pancakeswap_v3_zero_liquidity_pools: 124\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - balancer_zero_liquidity_pools: 0\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - Removed 0 unsupported exchanges. 481 pools remaining\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - Pools remaining per exchange:\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - carbon_v1: 184\n",
"2023-12-06 06:26:01,749 [fastlane:INFO] - bancor_v3: 13\n",
"2023-12-06 06:26:01,750 [fastlane:INFO] - bancor_v2: 0\n",
"2023-12-06 06:26:01,750 [fastlane:INFO] - bancor_pol: 72\n",
"2023-12-06 06:26:01,750 [fastlane:INFO] - uniswap_v3: 51\n",
"2023-12-06 06:26:01,750 [fastlane:INFO] - uniswap_v2: 90\n",
"2023-12-06 06:26:01,750 [fastlane:INFO] - sushiswap_v2: 7\n",
"2023-12-06 06:26:01,750 [fastlane:INFO] - balancer: 62\n",
"2023-12-06 06:26:01,750 [fastlane:INFO] - pancakeswap_v2: 0\n",
"2023-12-06 06:26:01,750 [fastlane:INFO] - pancakeswap_v3: 2\n",
"2023-12-06 06:26:01,774 [fastlane:INFO] - Transactions will be required to pass data validation for b3_two_hop\n",
"2023-12-06 06:26:01,775 [fastlane:WARNING] - base_exchange must be bancor_v3 for b3_two_hop, setting it to bancor_v3\n",
"2023-12-06 06:26:01,775 [fastlane:INFO] - flashloan_tokens for arb_mode=b3_two_hop will be overwritten. \n",
"2023-12-06 06:26:01,775 [fastlane:INFO] - limiting flashloan_tokens to ['WETH-6Cc2', 'LINK-86CA']\n",
"2023-12-06 06:26:01,794 [fastlane:INFO] - No eligible arb opportunities.\n",
"2023-12-06 06:26:13,799 [fastlane:INFO] - Timeout hit... stopping bot\n"
" Copy and paste the above configuration when reporting a bug. Please also include the error message and stack trace below:\n",
" \n",
" <INSERT ERROR MESSAGE AND STACK TRACE HERE>\n",
" \n",
" Please direct all questions/reporting to the Fastlane Telegram channel: https://t.me/BancorDevelopers\n",
" \n",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
" \n",
"2023-12-10 11:05:19,883 [fastlane:INFO] - [events.utils.handle_static_pools_update] Adding 286307 uniswap_v2 pools to static pools\n",
"2023-12-10 11:05:19,889 [fastlane:INFO] - [events.utils.handle_static_pools_update] Adding 3861 sushiswap_v2 pools to static pools\n",
"2023-12-10 11:05:19,895 [fastlane:INFO] - [events.utils.handle_static_pools_update] Adding 472 pancakeswap_v2 pools to static pools\n",
"2023-12-10 11:05:19,907 [fastlane:INFO] - [events.utils.handle_static_pools_update] Adding 286307 uniswap_v2 pools to static pools\n",
"2023-12-10 11:05:19,914 [fastlane:INFO] - [events.utils.handle_static_pools_update] Adding 17983 uniswap_v3 pools to static pools\n",
"2023-12-10 11:05:19,919 [fastlane:INFO] - [events.utils.handle_static_pools_update] Adding 158 pancakeswap_v3 pools to static pools\n",
"2023-12-10 11:05:20,287 [fastlane:INFO] - [main] Fetching events from 18757771 to 18757776... 0\n",
"2023-12-10 11:05:24,065 [fastlane:INFO] - [events.utils.get_latest_events] Found 171 new events, 82 carbon_pol_events\n"
]
}
],
Expand Down
5 changes: 3 additions & 2 deletions resources/NBTest/NBTest_903_FlashloanTokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ def run_command(mode):
# "--use_cached_events=True",
"--alchemy_max_block_fetch=5",
"--logging_path=fastlane_bot/data/",
"--timeout=80",
"--timeout=120",
"--blockchain=ethereum"
]
subprocess.Popen(cmd)

# Wait for the expected log line to appear
expected_log_line = "limiting flashloan_tokens to ["
found = False
result = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=120)
result = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=180)

# Check if the expected log line is in the output
if expected_log_line in result.stderr:
Expand All @@ -100,4 +100,5 @@ def run_command(mode):

# ## Test Flashloan Tokens b3_two_hop

# + is_executing=true
run_command("b3_two_hop")
Loading

0 comments on commit 682fe9b

Please sign in to comment.