atkinson/wagmi

Draft behavior of order execution logic

Closed this issue · 2 comments

Should we draft a spec with the overall behavior we want to implement? Then translate that into actual code handled by the right module.

This could take the form of a github gist (with python pseudo code, e.g), or a google doc, or other

No strong idea on the format. I find this kind of doc interesting: https://docs.hummingbot.io/strategies/twap
note the activity diagram that helps build a finite state machine (pseudo code can be enough) that could be tick-ed from a task queue, eg.

This could be the opportunity to clarify behavior (eg: are we supposed to have open orders overnight? what do we do with open orders intraday: what is the trigger for us to decide to replace their price? Should a TargetPositionRequest be considered constant during a day? etc)

I made a quick diagram of the execution logic, I hope this helps.

image

A few notes:

  • I think it would be wise to add a timeout to this loop, if reached it'll place a market order
  • Update price can use the order book and match the price of the 3rd best bid/ask
  • Security.name should lose the base currency 'BTC/USD' becomes 'BTC' then we can add an additional field execution_symbol to the security model. It can default to USD base currency (for spot) but can be manually changed in the admin panel. The logic for deciding this isn't trivial and doesn't need to be automated right now.

Drafted in a google doc, open for comment.

I'm considering closing this issue, unless somebody is actively working on this