delvtech / agent0

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

Agent refactor #1487

Closed slundqui closed 2 months ago

slundqui commented 2 months ago

This PR is the 3rd PR in a series of PRs for agent0 to support multiple pools.

The agent classes in agent0 is reworked in this PR. Here, the main changes include init_agent being a function of the chain as opposed to the pool. Additionally, many functions now take a pool argument to specify what pool the agent is making a trade on. There are helper functions for setting an active pool to avoid passing this argument in various functions, by calling it either in init_agent, or by calling agent.set_active(pool=...).

Additionally, the policy is now untied from the agent, such that an agent can hot-swap policies on the fly by calling the agent.set_active(policy=...) function.

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 90.13378% with 59 lines in your changes are missing coverage. Please review.

Project coverage is 81.35%. Comparing base (88157f3) to head (035c685).

:exclamation: Current head 035c685 differs from pull request most recent head b4c4b9e

Please upload reports for the commit b4c4b9e to get more accurate results.

Files Patch % Lines
...e/hyperdrive/interactive/local_hyperdrive_agent.py 83.45% 23 Missing :warning:
...t0/core/hyperdrive/interactive/hyperdrive_agent.py 85.18% 20 Missing :warning:
...yperdrive/interactive/exec/execute_agent_trades.py 93.22% 4 Missing :warning:
.../agent0/core/hyperdrive/interactive/local_chain.py 96.36% 4 Missing :warning:
...t0/core/hyperdrive/interactive/local_hyperdrive.py 80.95% 4 Missing :warning:
...gent0/core/hyperdrive/crash_report/crash_report.py 80.00% 2 Missing :warning:
...rc/agent0/hyperfuzz/unit_fuzz/fuzz_profit_check.py 50.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1487 +/- ## ========================================== - Coverage 83.89% 81.35% -2.54% ========================================== Files 88 97 +9 Lines 5674 6762 +1088 ========================================== + Hits 4760 5501 +741 - Misses 914 1261 +347 ``` | [Flag](https://app.codecov.io/gh/delvtech/agent0/pull/1487/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=delvtech) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/delvtech/agent0/pull/1487/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=delvtech) | `81.35% <90.13%> (-2.54%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=delvtech#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dpaiton commented 2 months ago

Note for followup. Left side is current dependency, right is what we want image