Author: Lawnel 0x27A
Original Post Date: 8 Jun 2022
I would like to propose a change in the PMM strategy I implemented and that I would like to integrate to the base library.
As discussed with cgambit a long time ago, there is a need for an automatic re-balance of inventory as soon as the base or the quote asset are not enough to submit a limit order on one of the two sides. basically whenever the strategy has accumulated inventory in one of the sides and thus there is no enough asset in the other side to submit an order, the strategy will submit a market order to re-balance inventory so we can have always two limit orders active and thus profit for the earnings without having to do it manually in the exchange as it is the case for some traders in the community.
the logic is as follow:
two parameters will be added to the PMM strategy :
- use market order boolean that would activate this feature if desired
- a threshold to trigger the market order if the order_amount is less than asset balance * threshold
As an example, suppose that the strategy targeting the pair AVAX/USDT with a price of 50 dollars with :
- balance of 2 AVAX and 100 dollars
- the order amount is 2: so we would have 2 AVAX in one side and 100 dollars in the other side
- the threshold is set to 10%
If the ask order is filled (so we sold 2 AVAX), the base balance would be: 0 AVAX and 200 dollars.
On the next refresh, we would have two options:
- the feature is not activated : the strategy will only post a buy limit order of 2 AVAX and no sell order (same as usual)
- the feature is activated: there is no AVAX in the balance which is below the 10% threshold= 0.2 AVAX. If the exchange allow a market order, the strategy will, trigger a market buy order of 2 AVAX. as soon as it is treated by the exchange, the strategy will post a buy and a sell order and could profit for earning on the two sides
one think though, some exchanges do not implement the market order (yeah Gate.io i am talking to you…) so I decided to use a limit order with negative spread which will be transformed by the exchange to a limit order on best bid or ask…
let me know your though and if this interests the community to propose it as PRP next.