atkinson/wagmi

Implement trade buffer with a sensible default

Opened this issue · 0 comments

A trade buffer prevents you from sending an order to the market if it only makes a minor change to the position.

e.g. if we have a position of 0.1 ETH and the algorithm says, make it 0.1001 ETH, we probably want to leave the position as is, avoiding trading fees.

pseudocode:

current_position = self.get_position(market)
delta = current_position - units
if abs(delta) > (trade_buffer * abs(current_position)):
    if delta < 0:
        self._place_order(market, side.SHORT, delta)
    else:
        self._place_order(market, side.LONG, delta)

trade buffer needs to originate in the strategy (e.g. yolo), and shouldn't really thread all of the way through to execution for implementation.