Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the initialization of the bot module outside of the main loop #560

Open
barakman opened this issue Apr 20, 2024 · 0 comments
Open

Move the initialization of the bot module outside of the main loop #560

barakman opened this issue Apr 20, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@barakman
Copy link
Collaborator

barakman commented Apr 20, 2024

Enhancement Description

  • The bot module is reinitialized on every iteration in the main loop
  • This seems to increase the duration of each iteration in that loop by 10-15 seconds

The purpose is to investigate which parts in the initialization of the bot module really need to take place on every iteration:

def init_bot(mgr: Any) -> CarbonBot:
    """
    Initializes the bot.

    Parameters
    ----------
    mgr : Base
        The manager object.

    Returns
    -------
    CarbonBot
        The bot object.
    """
    db = QueryInterface(
        mgr=mgr,
        ConfigObj=mgr.cfg,
        state=mgr.pool_data,
        uniswap_v2_event_mappings=mgr.uniswap_v2_event_mappings,
        exchanges=mgr.exchanges,
    )
    bot = CarbonBot(ConfigObj=mgr.cfg)
    bot.db = db
    # bot.TxSubmitHandler.ConfigObj = mgr.cfg
    # bot.TxSubmitHandler.ConfigObj.w3 = mgr.cfg.w3
    # bot.TxSubmitHandler.ConfigObj.w3 = mgr.cfg.w3
    assert isinstance(
        bot.db, QueryInterface
    ), "QueryInterface not initialized correctly"
    return bot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant