I have a question regarding the Stellar DEX. My understanding is that the book building and order matching is done by the protocol itself. Orders are placed through APIs such as Stellar X, Stellar Term or others. But what is the sequence once the buy/sell orders have been matched? How work the settlement? Is it still within the protocol or it has to happen on a different platform (with peer to peer interaction?). Apologies, I am a finance guy, no a tech guy, hence have limitations on the code understanding ! Many thanks for your feedback
When a user creates an order, the corresponding amount of the tokens to sell is automatically locked on her balance (the outstanding amount on orders is listed as
selling_liabilities on the account properties). Once another user submits a crossing order, a trade is executed automatically. Both users immediately receive bought tokens on their balances.
All DEX components including the orders management, orderbook, matching, and settlement are implemented on the protocol level.
StellarX, StellarTerm, StellarPort, Interstellar and others offer a fancy user interface that simplifies the interaction with the ledger. However, all order manipulations and trades are executed directly on-chain in a form of transactions, so Stellar DEX is truly a decentralized peer-to-peer exchange on the blockchain.