delvtech / agent0

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

feature request: speed up data pipeline #960

Open wakamex opened 12 months ago

wakamex commented 12 months ago

currently, running arbitrary bot actions back-to-back can't be done right away. that's because the second execution instantiates its wallet from the chainsync process running in the background, which may be a few milliseconds behind. I found a time.sleep(1) call to be sufficient to let it catch up. however, this is a bit messy and sub-optimal. Avoiding that would be ideal. A few ways to do so are:

  1. create a wait_for_data() function which waits for chainsync to update to the latest block
  2. allow instantiating bot wallets directly from the chain, without the use of chainsync. as discussed at the offsite, this is the only case where bots require the data backend to run, so creating an alternate method would remove this dependency.
slundqui commented 12 months ago

This is a known issue. Unfortunately, solution number 2 isn't feasible because anvil loses state after some time, and getting shorts/longs needs deltas from the beginning of time. I'll look into solution 1, but on the server side to ensure the analysis pipeline is up to date before returning

dpaiton commented 12 months ago

Marking this as backlog until after the 17th

dpaiton commented 4 months ago

need to explore with new refactors, might be able to run data pipeline async