Policies
The agent follows "policies" to make decisions.
The policy defines the mapping from the environment-observations to the actions that are being taken.
Within Dojo, the policy can be referred to as the agent's DeFi strategy. This is where you can get creative by implementing your own strategy!
Purpose
The policy predict(obs)
method is run to generate a sequence of actions to be run in the block.
You can think of the policy as the brain of the agent, where it decides what to do based on conditions defined by your trading strategy.
Policy Implementation
To test out your own DeFi policy, all you need to do is implement the predict(obs)
method.
It takes the observation object from the environment as input and returns a list of actions as output.
In this example, we consider a basic policy for trading on UniswapV3, where we define an upper and lower spot-price and once the price reaches the upper or lower limit, all tokens are converted to the currently lower value token:
These are just example policies to get you started. You can get a lot more creative and sophisticated than this.