atkinson / wagmi

An execution framework for systematic strategies
BSD 2-Clause "Simplified" License
10 stars 12 forks source link

Implement trade buffer with a sensible default #2

Open atkinson opened 2 years ago

atkinson commented 2 years ago

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.