Drakkar-Software / Triangular-Arbitrage

Crypto triangular arbitrage by OctoBot
https://www.octobot.cloud/tools/triangular-arbitrage?utm_source=github&utm_medium=dk&utm_campaign=free_tools&utm_content=repo_link
GNU Affero General Public License v3.0
47 stars 14 forks source link

max_cycle is NoneType #22

Open ruidazeng opened 4 hours ago

ruidazeng commented 4 hours ago

It seems like the code has the following bug when I ran it:

 File "C:\Users\RAZEER\Documents\Triangular-Arbitrage\triangular_arbitrage\detector.py", line 73, in get_best_opportunity
    if len(cycle) > max_cycle:
       ^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'int' and 'NoneType'

After investigation, it seems like despite setting the max_cycle to a default value of 10 in the following function:

def get_best_opportunity(tickers: List[ShortTicker], max_cycle: int = 10) -> Tuple[List[ShortTicker], float]:

This was usurped by the following function instead, which set the max_cycle=None if nothing is set by the user.

async def run_detection(exchange_name, ignored_symbols=None, whitelisted_symbols=None, max_cycle=None):
    last_prices = await get_exchange_last_prices(exchange_name, ignored_symbols or [], whitelisted_symbols)
    # default is the best opportunity for all cycles
    best_opportunity, best_profit = get_best_opportunity(last_prices, max_cycle=max_cycle)
    return best_opportunity, best_profit

I am checking for more issues while running the benchmarks, and will submit a pull request to both the benchmarks branch and the main branch (if needed) at some point later.

ruidazeng commented 3 hours ago

This is linked to #23