delvtech / agent0

Analysis & simulation repo for Delv
https://agent0.readthedocs.io/en/latest/
Apache License 2.0
52 stars 21 forks source link

agent0: Bots get current wallet positions (from chain? from db?) so it can pick up where it left off on bot process restart #850

Closed slundqui closed 1 year ago

slundqui commented 1 year ago

Currently, agent0 bots are assuming the process starts and never stops and breaks (lol). Ideally, we should be able to stop the bots process, potentially make logic updates, and bots pick up where they left off (as long as the number of bots and bot addresses stay the same). This involves getting bot positions on bot launch, either from the chain or from the db, so it can always keep track of it's positions within the bot.

wakamex commented 1 year ago

this is needed for basic analysis. anything that looks like this:

code_A
code_B

code_B doesn't have access to any positions that were created in code_A. this includes the default liquidity deployed in the devnet image by agent_0. so as it stands, I can't withdraw that liquidity.

we had a mostly working solution for restoring agent wallets in the unfinished dump_state code referenced here: https://github.com/delvtech/elf-simulations/issues/615#issuecomment-1619141834

wakamex commented 1 year ago

will review this week and see how much old code we can re-use, and what's left to do, at a minimum

could pull in from database, or from a general "read everything on the chain" function. the latter is preferable, which could also be used by the database in certain recovery modes.

dpaiton commented 1 year ago

FYI We solved this to some extent back when we used APE. The issue was #419 and the PR was #416

FE also does this from chain

dpaiton commented 1 year ago

Would be nice to have both a "from db" solution and a "from chain" solution, since each solution has its pros/cons

dpaiton commented 1 year ago

Resolved from #894