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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1064c5c
Updating local example
slundqui May 20, 2024
492e4f6
Updating remote example
slundqui May 20, 2024
6701bb1
Moving init agent and related functions from local hyperdrive to loca…
slundqui May 20, 2024
1ebf842
Moving initialize agent to chain
slundqui May 20, 2024
ccb545d
Initializing agent from chain
slundqui May 21, 2024
c4180ee
Adding pool to arguments
slundqui May 21, 2024
a7cc28c
Using local account instead of policy agent
slundqui May 21, 2024
2adacc8
Minor fixes
slundqui May 21, 2024
1b6be75
Minor fixes
slundqui May 21, 2024
a230579
Fixing local hyperdrive agent with new arguments
slundqui May 21, 2024
b708e06
Removing policy agents
slundqui May 21, 2024
2b3a4f7
fixing circular imports
slundqui May 21, 2024
3cfbf4b
Allow setting active pool in constructor. Fixing loading snapshot wit…
slundqui May 22, 2024
231f62c
Fixing remote example
slundqui May 22, 2024
3d6deda
Fixing forking example
slundqui May 22, 2024
5597e25
Fixing tests
slundqui May 22, 2024
10175bb
Fixing more tests
slundqui May 22, 2024
3b79de4
Fixing more tests
slundqui May 23, 2024
30c35f8
Fixing hyperdrive test in getting positions
slundqui May 23, 2024
d6715ec
Fixing more tests
slundqui May 23, 2024
49a1bf0
Fixing fuzz pipeline and adding test
slundqui May 23, 2024
058def6
Fixing incompatible function overwrites
slundqui May 23, 2024
529a228
Adding unit fuzz bot test, and snapshot saves active pool for agent
slundqui May 23, 2024
2ce321d
Bug fix for type checking
slundqui May 23, 2024
c0480de
Updating traider daive
slundqui May 23, 2024
3cb144f
lint
slundqui May 23, 2024
5d48438
Fixing circular import
slundqui May 23, 2024
ec31fc8
lint
slundqui May 23, 2024
6aed6a6
Removing update functions in hyperdrive wallet
slundqui May 23, 2024
aab5ab6
Unused imports
slundqui May 23, 2024
05b4eca
Comments for examples
slundqui May 23, 2024
5cc67fd
Using Paths throughout
slundqui May 23, 2024
2e07736
Fixing return type
slundqui May 23, 2024
cd40aa7
Fixing comment
slundqui May 23, 2024
d4ecf86
Updating tutorial notebook
slundqui May 23, 2024
deedff5
Fixing name
slundqui May 23, 2024
035c685
Clarification in text
slundqui May 23, 2024
b4c4b9e
Fixing links
slundqui May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions examples/interactive_hyperdrive_forking_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from fixedpointmath import FixedPoint

from agent0 import Hyperdrive, LocalChain, PolicyZoo
from agent0 import LocalChain, LocalHyperdrive, PolicyZoo
from agent0.core.base.make_key import make_private_key

# %%
Expand All @@ -26,26 +26,22 @@
# Launch a local anvil chain forked from the rpc uri.
chain = LocalChain(fork_uri=rpc_uri, fork_block_number=fork_block_number)

hyperdrive_address = Hyperdrive.get_hyperdrive_addresses_from_registry(chain, registry_address)["sdai_14_day"]
hyperdrive_address = LocalHyperdrive.get_hyperdrive_addresses_from_registry(chain, registry_address)["sdai_14_day"]

# Note that we use Hyperdrive here instead of LocalHyperdrive,
# as LocalHyperdrive deploys a new pool, whereas we want to connect to an existing pool
# on the forked local chain.
# TODO this prevents us from using data tools provided by LocalHyperdrive, ideally we can
# load a LocalHyperdrive from an Hyperdrive object that connects to an existing pool and populates
# the database. This is blocked by needing an archive node, the fix here would be to
# (1) use event data instead, and (2) build historical data from event data.
hyperdrive_config = Hyperdrive.Config()
hyperdrive_pool = Hyperdrive(chain, hyperdrive_address, hyperdrive_config)
# Note that we pass in deploy=False and pass in an existing hyperdrive_address, as we
# want to connect to the existing pool and not deploy a new one.
hyperdrive_config = LocalHyperdrive.Config()
hyperdrive_pool = LocalHyperdrive(chain, hyperdrive_config, deploy=False, hyperdrive_address=hyperdrive_address)

# %%

# Launch a new agent
private_key = make_private_key()

# Init from private key and attach policy
hyperdrive_agent0 = hyperdrive_pool.init_agent(
hyperdrive_agent0 = chain.init_agent(
private_key=private_key,
pool=hyperdrive_pool,
policy=PolicyZoo.random,
# The configuration for the underlying policy
policy_config=PolicyZoo.random.Config(rng_seed=123),
Expand Down
80 changes: 0 additions & 80 deletions examples/interactive_local_hyperdrive_advanced_example.py

This file was deleted.

Loading
Loading