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

Agent refactor #1487

Merged
merged 38 commits into from
May 23, 2024
Merged

Agent refactor #1487

merged 38 commits into from
May 23, 2024

Conversation

slundqui
Copy link
Contributor

@slundqui slundqui commented May 23, 2024

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.

  • init_agent is now a function of a LocalChain or Chain object.
    • This function now takes an optional pool argument for setting an initial active pool.
  • Many functions now require an active pool to be set, or an explicit pool to be passed in as an argument.
  • PolicyAgent has been deprecated in favor of using LocalAccount.
  • Moving many logging and bookkeeping configs from Hyperdrive and LocalHyperdrive to Chain and LocalChain respectively.
  • No longer keeping track of wallet deltas, we get the wallet wrt a pool via get_wallet().
  • Adding helper functions for get_long(), get_short(), get_lp(), and get_withdrawal_shares().
  • LocalHyperdrive now has a flag for deploying on constructor, or attach to existing. This is necessary for the forking workflow.
  • Added tests for unit and system fuzzing.

Copy link

codecov bot commented May 23, 2024

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).

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 ⚠️
...t0/core/hyperdrive/interactive/hyperdrive_agent.py 85.18% 20 Missing ⚠️
...yperdrive/interactive/exec/execute_agent_trades.py 93.22% 4 Missing ⚠️
.../agent0/core/hyperdrive/interactive/local_chain.py 96.36% 4 Missing ⚠️
...t0/core/hyperdrive/interactive/local_hyperdrive.py 80.95% 4 Missing ⚠️
...gent0/core/hyperdrive/crash_report/crash_report.py 80.00% 2 Missing ⚠️
...rc/agent0/hyperfuzz/unit_fuzz/fuzz_profit_check.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            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 Coverage Δ
unittests 81.35% <90.13%> (-2.54%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@slundqui slundqui merged commit d9abea2 into delvtech:main May 23, 2024
3 checks passed
@slundqui slundqui deleted the agent-refactor branch May 23, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants