Introduction to Money On Chain’s Decentralized Token Exchange on RSK Platform

MoneyOnChain
MoneyOnChain
Published in
3 min readJun 16, 2020

Introduction

Unlike most traditional cryptocurrency exchanges, the mechanism used for trading in the Money On Chain Decentralized Token Exchange (TEX) is based on The London Gold Fix method, which sets the value of gold twice per day based on the current order book (OB). Users who place orders in the OB can cancel them at any time.

This method is proposed as a way to avoid front-running, and ensures fair price discovery — even with low volume.

Limit Order (LO)

Initially, TEX handles only Limit Orders, which represent orders to buy or sell at a specific price. The total amount of the order is provisionally deducted from the balance of the user’s account. It establishes restrictions regarding the maximum price to be paid or the minimum price at which to sell. The order is executed — that is, it is bought or sold on the tick — as long as the established price meets the restrictions to buy or sell at a certain price. When the terms of an order can’t be fully met by the system, it can be partially executed.

1 https://en.wikipedia.org/wiki/Gold_fixing

Order Book (OB)

Account owners load the OB between ticks for each pair listed. The Order Book features two branches or components — namely, Sale Limit and Purchase Limit — which are loaded separately and independently. The OB is processed as follows:

  • With each inserted order, the sales branch is sorted in ascending order by price, and the purchase branch in descending order. The positions are then paired.
  • In addition, those orders with the same price must also be ordered by the date of entry so as to ensure that the oldest ones are closed first.

Example:

Matching Partials orders

Each of the positions in the previous table is broken down into partial positions so that each line can be matched.

The positions are then paired and whether it is feasible or not to close them, taking into account that the purchase price is greater than or equal to the sale price, is determined. The last position may be a partial of the original table. The closing price is the average purchase and sale price of the last feasible position.

Following the previous example:

Close of operations

The operations are closed in order, from top to bottom, in the paired table. All are closed at the price set in the previous step.

Unfeasible OB

If the purchase price of the first pair of the table is lower than the sale price, the OB is unfeasible and everything is returned for the next tick.

Operations not closed

Operations that could not be closed are returned to the OB for the next tick. If the position was partially closed, the return to the OB can also be partial.

Using TEX

Money On Chain Decentralized Token Exchange (TEX) currently is deployed to be used on RSK Testnet at: https://tex-testnet.moneyonchain.com/

--

--