agent0.core.hyperdrive.interactive.local_hyperdrive_test

Tests interactive hyperdrive end to end.

Attributes

YEAR_IN_SECONDS

Functions

test_funding_and_trades(fast_chain_fixture, deploy_type)

Deploy 2 pools, 3 agents, and test funding and each trade type.

test_no_loss_in_precision()

test_bot_to_db(fast_hyperdrive_fixture, cycle_trade_policy)

test_block_timestamp_interval(fast_chain_fixture)

Ensure block timestamp interval is set correctly.

test_advance_time(fast_chain_fixture)

Advance time by 3600 seconds then 1 week.

test_advance_time_with_checkpoints(fast_chain_fixture)

Checkpoint creation with advance time.

test_save_load_snapshot(chain_fixture)

Save and load snapshot.

test_set_variable_rate(fast_chain_fixture)

Set the variable rate.

test_dashboard_dfs(fast_hyperdrive_fixture)

Tests building of dashboard dataframes.

test_access_deployer_account(fast_chain_fixture)

Access the deployer account.

test_access_deployer_liquidity(fast_chain_fixture)

Remove liquidity from the deployer account.

test_remove_deployer_liquidity(fast_chain_fixture)

Remove liquidity from the deployer account.

test_get_config_no_transactions(fast_chain_fixture)

Get pool config before executing any transactions.

test_get_config_with_transactions(fast_chain_fixture)

Get pool config after executing one transaction.

test_liquidate(fast_chain_fixture)

Test liquidation.

test_random_liquidate(fast_chain_fixture)

Test random liquidation.

test_share_price_compounding_quincunx(fast_chain_fixture)

Share price when compounding by quincunx (one fifth of a year) should increase by more than the APR.

test_share_price_compounding_annus(fast_chain_fixture)

Share price when compounding by annus (one year) should increase by exactly the APR (no compounding).

test_policy_config_forgotten(fast_chain_fixture)

The policy config is not passed in.

test_policy_config_none_rng(fast_chain_fixture)

The policy config has rng set to None.

test_pool_creation_after_snapshot(chain_fixture)

test_snapshot_policy_state(chain_fixture)

Tests proper saving/loading of policy state during snapshotting.

test_load_rng_on_snapshot()

The policy config has rng set to None.

test_hyperdrive_read_interface_standardized_variable_rate(...)

test_deploy_nonstandard_timestretch(...)

Deploy with nonstandard timestretch parameters.

test_lazy_calc_pnl()

Tests lazy calc pnl values.

test_fork()

Tests forking a chain.

test_fork_backfill()

Tests backfilling data from a forked chain.

test_fork_backfill_sample()

Tests backfilling data from a forked chain.

test_anvil_dump_state(capsys)

Tests dumping anvil state.

test_close_long_too_much_fees(fast_chain_fixture)

Test to catch custom error when fees > close long proceeds.

Module Contents

agent0.core.hyperdrive.interactive.local_hyperdrive_test.YEAR_IN_SECONDS = 31536000
agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_funding_and_trades(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain, deploy_type: agent0.core.hyperdrive.interactive.local_hyperdrive.LocalHyperdrive.DeployType)

Deploy 2 pools, 3 agents, and test funding and each trade type.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_no_loss_in_precision()
agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_bot_to_db(fast_hyperdrive_fixture: agent0.core.hyperdrive.interactive.local_hyperdrive.LocalHyperdrive, cycle_trade_policy: Type[agent0.core.test_utils.CycleTradesPolicy])
agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_block_timestamp_interval(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Ensure block timestamp interval is set correctly.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_advance_time(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Advance time by 3600 seconds then 1 week.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_advance_time_with_checkpoints(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Checkpoint creation with advance time.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_save_load_snapshot(chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Save and load snapshot.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_set_variable_rate(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Set the variable rate.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_dashboard_dfs(fast_hyperdrive_fixture: agent0.core.hyperdrive.interactive.local_hyperdrive.LocalHyperdrive)

Tests building of dashboard dataframes.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_access_deployer_account(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Access the deployer account.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_access_deployer_liquidity(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Remove liquidity from the deployer account.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_remove_deployer_liquidity(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Remove liquidity from the deployer account.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_get_config_no_transactions(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Get pool config before executing any transactions.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_get_config_with_transactions(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Get pool config after executing one transaction.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_liquidate(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Test liquidation.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_random_liquidate(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Test random liquidation.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_share_price_compounding_quincunx(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Share price when compounding by quincunx (one fifth of a year) should increase by more than the APR.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_share_price_compounding_annus(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Share price when compounding by annus (one year) should increase by exactly the APR (no compounding).

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_policy_config_forgotten(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

The policy config is not passed in.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_policy_config_none_rng(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

The policy config has rng set to None.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_pool_creation_after_snapshot(chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)
agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_snapshot_policy_state(chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Tests proper saving/loading of policy state during snapshotting.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_load_rng_on_snapshot()

The policy config has rng set to None.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_hyperdrive_read_interface_standardized_variable_rate(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)
agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_deploy_nonstandard_timestretch(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain, time_stretch: float)

Deploy with nonstandard timestretch parameters.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_lazy_calc_pnl()

Tests lazy calc pnl values.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_fork()

Tests forking a chain.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_fork_backfill()

Tests backfilling data from a forked chain.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_fork_backfill_sample()

Tests backfilling data from a forked chain.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_anvil_dump_state(capsys)

Tests dumping anvil state.

capsys is a pytest fixture that captures output, which we need to get the crash report file.

agent0.core.hyperdrive.interactive.local_hyperdrive_test.test_close_long_too_much_fees(fast_chain_fixture: agent0.core.hyperdrive.interactive.local_chain.LocalChain)

Test to catch custom error when fees > close long proceeds.