agent0.core.hyperdrive.policies.simple_lp

Agent policy for LP trading that modifies liquidity for a target profitability.

Classes

SimpleLP

LP to maintain profitability.

Module Contents

class agent0.core.hyperdrive.policies.simple_lp.SimpleLP(policy_config: Config)

Bases: agent0.core.hyperdrive.policies.hyperdrive_policy.HyperdriveBasePolicy

LP to maintain profitability.

classmethod description() str

Describe the policy in a user friendly manner that allows newcomers to decide whether to use it.

Returns:

The description of the policy, as described above.

Return type:

str

class Config

Bases: agent0.core.hyperdrive.policies.hyperdrive_policy.HyperdriveBasePolicy.Config

Custom config arguments for this policy.

pnl_target: fixedpointmath.FixedPoint

The target PNL for the bot, in base.

delta_liquidity: fixedpointmath.FixedPoint

How much liquidity to add or remove, depending on policy outcome, in base.

minimum_liquidity_value: fixedpointmath.FixedPoint

Minimum liquidity the bot will provide, in base. It will keep this much liquidity in the pool, even if it is losing money.

lookback_length: int = 10

How many steps back to look when computing PNL progress over time. Each time action is called is a step.

policy_config
pnl_history: list[tuple[fixedpointmath.FixedPoint, fixedpointmath.FixedPoint]] = []
total_base_spent: fixedpointmath.FixedPoint
action(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) tuple[list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]], bool]

Specify actions.

Parameters:
Returns:

A tuple where the first element is a list of actions, and the second element defines if the agent is done trading.

Return type:

tuple[list[MarketAction], bool]

post_action(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, trade_results: list[agent0.core.hyperdrive.TradeResult]) None

Keep track of money spent.

Parameters:
  • interface (MarketInterface) – The trading market interface.

  • trade_results (list[HyperdriveTradeResult]) – A list of HyperdriveTradeResult objects, one for each trade made by the agent. The order of the list matches the original order of agent.action. HyperdriveTradeResult contains any information about the trade, as well as any errors that the trade resulted in.