coblox / nectar

GNU General Public License v3.0
0 stars 1 forks source link

PoC for main loop #26

Closed da-kami closed 4 years ago

da-kami commented 4 years ago

Thanks to @thomaseizinger for helping me fleshing this out :)

The idea cycles around one main event loop, that first always updates the mid-market-rate and balances in the Maker and then reacts to events happening on the network. Reacting to network events has a timeout, so we ensure that we update the balance and rate periodically. (Additionally the maker's logic can actually ensure that rate/balance is not outdated from his point of view if e.g. we cannot fetch rate from Kraken no orders should be published until we have an up-to-date rate again - but that is future music :)

Events that can happen on the network:

The Maker, the central component that bundles the decision logic, holds all the states and reacts to events happening on the network. After handling an event the Maker returns an Action (that includes possible data, e.g. a new Order) that can be actioned on by the event loop (i.e. publishing the new order in the orderbook). The event -> action model helps us with testing the Maker's logic - see the POC test in main.

Create this as a Draft for it now - we can also merge it if we feel like it.

da-kami commented 4 years ago

closing and re-opening as actual PR