agent0.core.hyperdrive ====================== .. py:module:: agent0.core.hyperdrive .. autoapi-nested-parse:: Objects for bots to interface with Hyperdrive contracts and the Rust interface. .. !! processed by numpydoc !! Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/agent0/core/hyperdrive/agent/index /autoapi/agent0/core/hyperdrive/crash_report/index /autoapi/agent0/core/hyperdrive/interactive/index /autoapi/agent0/core/hyperdrive/policies/index /autoapi/agent0/core/hyperdrive/utilities/index Classes ------- .. autoapisummary:: agent0.core.hyperdrive.HyperdriveActionType agent0.core.hyperdrive.HyperdriveMarketAction agent0.core.hyperdrive.HyperdriveWallet agent0.core.hyperdrive.Long agent0.core.hyperdrive.Short agent0.core.hyperdrive.TradeResult Package Contents ---------------- .. py:class:: HyperdriveActionType Bases: :py:obj:`enum.Enum` The descriptor of an action in a market. .. !! processed by numpydoc !! .. py:attribute:: INITIALIZE_MARKET :value: 'initialize_market' .. py:attribute:: OPEN_LONG :value: 'open_long' .. py:attribute:: CLOSE_LONG :value: 'close_long' .. py:attribute:: OPEN_SHORT :value: 'open_short' .. py:attribute:: CLOSE_SHORT :value: 'close_short' .. py:attribute:: ADD_LIQUIDITY :value: 'add_liquidity' .. py:attribute:: REMOVE_LIQUIDITY :value: 'remove_liquidity' .. py:attribute:: REDEEM_WITHDRAW_SHARE :value: 'redeem_withdraw_share' .. py:class:: HyperdriveMarketAction Bases: :py:obj:`agent0.core.base.BaseMarketAction`\ [\ :py:obj:`HyperdriveActionType`\ ] Market action specification. .. !! processed by numpydoc !! .. py:attribute:: action_type :type: HyperdriveActionType .. py:attribute:: trade_amount :type: fixedpointmath.FixedPoint .. py:attribute:: maturity_time :type: int | None :value: None .. py:attribute:: slippage_tolerance :type: fixedpointmath.FixedPoint | None :value: None .. py:attribute:: gas_limit :type: int | None :value: None .. py:attribute:: base_fee_multiple :type: float | None :value: None .. py:attribute:: priority_fee_multiple :type: float | None :value: None .. py:attribute:: min_apr :type: fixedpointmath.FixedPoint .. py:attribute:: max_apr :type: fixedpointmath.FixedPoint .. py:class:: HyperdriveWallet Bases: :py:obj:`agent0.core.base.EthWallet` Stateful variable for storing what is in the agent's wallet. .. !! processed by numpydoc !! .. py:attribute:: lp_tokens :type: fixedpointmath.FixedPoint The LP tokens held by the trader. .. !! processed by numpydoc !! .. py:attribute:: withdraw_shares :type: fixedpointmath.FixedPoint The amount of unclaimed withdraw shares held by the agent. .. !! processed by numpydoc !! .. py:attribute:: longs :type: dict[int, Long] The long positions held by the trader. The dictionary is keyed by the maturity time in seconds. .. !! processed by numpydoc !! .. py:attribute:: shorts :type: dict[int, Short] The short positions held by the trader. The dictionary is keyed by the maturity time in seconds. .. !! processed by numpydoc !! .. py:method:: copy() -> HyperdriveWallet Return a new copy of self. :returns: A deep copy of the wallet. :rtype: HyperdriveWallet .. !! processed by numpydoc !! .. py:class:: Long An open long position. .. todo:: make balance a Quantity to enforce units .. !! processed by numpydoc !! .. py:attribute:: balance :type: fixedpointmath.FixedPoint The amount of bonds that the position is long. .. !! processed by numpydoc !! .. py:attribute:: maturity_time :type: int The maturity time of the long. .. !! processed by numpydoc !! .. py:class:: Short An open short position. .. !! processed by numpydoc !! .. py:attribute:: balance :type: fixedpointmath.FixedPoint The amount of bonds that the position is short. .. !! processed by numpydoc !! .. py:attribute:: maturity_time :type: int The maturity time of the short. .. !! processed by numpydoc !! .. py:class:: TradeResult A data object that stores all information of an executed trade. .. !! processed by numpydoc !! .. py:attribute:: trade_successful :type: bool The status of the trade. .. !! processed by numpydoc !! .. py:attribute:: account :type: eth_account.signers.local.LocalAccount | None :value: None The agent that was executing the trade. .. !! processed by numpydoc !! .. py:attribute:: wallet :type: agent0.core.hyperdrive.agent.hyperdrive_wallet.HyperdriveWallet | None :value: None The wallet of the agent that was executing the trade. .. !! processed by numpydoc !! .. py:attribute:: policy :type: agent0.core.hyperdrive.policies.HyperdriveBasePolicy | None :value: None The policy that was executing the trade. .. !! processed by numpydoc !! .. py:attribute:: trade_object :type: agent0.core.base.Trade[agent0.core.hyperdrive.agent.hyperdrive_actions.HyperdriveMarketAction] | None :value: None The trade object for the trade. .. !! processed by numpydoc !! .. py:attribute:: hyperdrive_event :type: pypechain.core.BaseEvent | None :value: None The transaction receipt of the trade. .. !! processed by numpydoc !! .. py:attribute:: contract_call :type: dict[str, Any] | None :value: None A dictionary detailing the underlying contract call. .. !! processed by numpydoc !! .. py:attribute:: is_slippage :type: bool :value: False If the trade failed due to slippage. .. !! processed by numpydoc !! .. py:attribute:: is_invalid_balance :type: bool :value: False If the trade failed due to invalid balance. .. !! processed by numpydoc !! .. py:attribute:: is_insufficient_allowance :type: bool :value: False If the trade failed due to insufficient approval. .. !! processed by numpydoc !! .. py:attribute:: is_min_txn_amount :type: bool :value: False If the trade failed due to minimum transaction amount. .. !! processed by numpydoc !! .. py:attribute:: is_long_proceeds_less_than_fees :type: bool :value: False If the trade failed due long proceeds less than fees. .. !! processed by numpydoc !! .. py:attribute:: block_number :type: int | None :value: None The block number of the transaction. .. !! processed by numpydoc !! .. py:attribute:: block_timestamp :type: int | None :value: None The block timestamp of the transaction. .. !! processed by numpydoc !! .. py:attribute:: exception :type: Exception | None :value: None The exception that was thrown. .. !! processed by numpydoc !! .. py:attribute:: orig_exception :type: Exception | list[Exception] | BaseException | None :value: None If exception was wrapped, the original exception that was thrown. .. !! processed by numpydoc !! .. py:attribute:: pool_config :type: dict[str, Any] | None :value: None The pool config information. .. !! processed by numpydoc !! .. py:attribute:: pool_info :type: dict[str, Any] | None :value: None The pool info information. .. !! processed by numpydoc !! .. py:attribute:: checkpoint_info :type: dict[str, Any] | None :value: None The checkpoint info information. .. !! processed by numpydoc !! .. py:attribute:: contract_addresses :type: dict[str, Any] | None :value: None The contract addresses. .. !! processed by numpydoc !! .. py:attribute:: additional_info :type: dict[str, Any] | None :value: None Additional information used for crash reporting. .. !! processed by numpydoc !! .. py:attribute:: raw_transaction :type: dict[str, Any] | None :value: None The raw transaction sent to the chain. .. !! processed by numpydoc !! .. py:attribute:: raw_pool_config :type: dict[str, Any] | None :value: None The raw pool config. .. !! processed by numpydoc !! .. py:attribute:: raw_pool_info :type: dict[str, Any] | None :value: None The raw pool info. .. !! processed by numpydoc !! .. py:attribute:: raw_checkpoint :type: dict[str, Any] | None :value: None The raw checkpoint info. .. !! processed by numpydoc !! .. py:attribute:: anvil_state :type: str | None :value: None The dumped anvil state. .. !! processed by numpydoc !!