Introducing AlphaDEX (Part 2)

Rodrigez | AlphaDEX
AlphaDEX XRD
Published in
4 min readMar 7, 2023

To find Part (1) of this introductory article you can jump back here: https://medium.com/@alphadex_exchange/introducing-alphadex-part-1-55b77d250221

An exchange for builders

To make it as easy as possible for dApp builders on Radix to integrate with AlphaDEX, it offers a full stack of integration layers to provide developers with the level of integration that best suits their needs.

Scrypto Components

AlphaDEX consists of two main Scrypto components (similar to smart contracts on other networks) that contain all the logic needed for an order book exchange

  • AlphaDEX component

This Scrypto component controls the overall exchange and its administration functions and maintains a list of pairs that are tradeable on the exchange.

  • AlphaDEX Pair component

A Scrypto component that controls the trading and admin functionality for every pair on the exchange. This component keeps track of the orderbook and contains the matching engine logic that is required to match new and existing orders. Every pair on AlphaDEX is a separate Scrypto component, meaning trades on different pairs happen independent from each other. This means trade throughput on AlphaDEX is linearly scalable with the number of pairs (i.e. the more pairs you add to the exchange, the higher the maximum throughput of the exchange).

Developers can interact directly with these Scrypto components through a number of methods that follow the principles of asset orientation and composability that make Radix components so powerful. This means AlphaDEX can easily be called and interact with by other Scrypto components or can be included as part of a complicated transaction manifest that involves many different Scrypto components.

API and Websockets Server

For developers who do not want to interact directly with Scrypto components, AlphaDEX offers a comprehensive REST API that offers several convenience functions for easy order submission, getting price and cost quotes before order submission and extensive exchange data query capabilities. The REST API allows developers to access the AlphaDEX functionality and data in a format that is familiar and similar to what they would be used to when developing web2 apps using centralized exchanges.

In addition, AlphaDEX also offers a websocket server that allows developers to subscribe to a live feed of exchange data. This means their apps will automatically be updated with the latest data from AlphaDEX every time something changes on the exchange (e.g. live orderbook, live prices etc).

Javascript SDK

To make integration even more straightforward for developers, AlphaDEX offers a complete Typescript/Javascript SDK (software development kit). Essentially the SDK allows app developers to simply import an AlphaDEX module into their code which will provide them with all the functionality of AlphaDEX (submitting orders, getting quotes etc) and will provide live data as variables in their app without any knowledge of working with APIs or Scrypto components. This should allow even a beginner web developer to incorporate AlphaDEX functionality into their first web apps (Look out for a future blog post on exactly this).

AlphaDEX SDKs for other popular programming languages will follow in the future.

Fees

The fee structure has been designed to benefit everyone and this is fundamental to the success of the exchange.

AlphaDEX decided to not issue tokens that will give holders a share of the profit of the exchange. Not only does this help to avoid some complicated legal issues, but it also avoids the situation where you have a small collection of very large token holders that earn most of the profits from the exchange and use their control to ensure the exchange earns as much as possible, often to the detriment of the users of the exchange.

Instead, AlphaDEX would rather share the majority of fees earned on trades with the participants on the exchange. In this way the people that use the exchange the most are also those that will benefit the most from its fee structure.

The fees on AlphaDEX is based on two simple principles:

  1. Make trading as cheap as possible
  2. Pay fees to those that make the exchange work efficiently

The fee earned on every trade on AlphaDEX can be between 0.5% and 0.05% and is distributed as follows:

  • Liquidity Provider (Market Maker) Fee

This fee is paid to the liquidity provider (also called the market maker) on every trade. The liquidity provider can be anyone that had an existing (open) order on the exchange which was matched with a new order. The liquidity fee for every pair can vary between 0.35% and 0% and will depend on the volume traded in a pair. In pairs with low trading volume, the maximum liquidity fee is payable to encourage traders to provide liquidity and increase the efficiency of trading in the pair. In pairs with very high trading volume, no extra incentive to provide liquidity is needed and therefore the fee can be lower. This also has the effect of making AlphaDEX more competitive in high volume pairs.

  • Platform (App) Fee

This fee is paid to the platform (app) through which orders are submitted to the exchange. By paying apps for the orders they submit, AlphaDEX not only encourages participation on the exchange, but it also means app builders do not have to charge their clients separately for facilitating the trade. The platform fee can be set by the app builder to between 0.1% and 0% and the app can have different platform fees for different users. Any discount in the platform fee is passed back to the user.

  • Exchange (AlphaDEX) Fee

This fee is paid to the AlphaDEX exchange and is used for the running of the exchange and its continued development.

--

--

Rodrigez | AlphaDEX
AlphaDEX XRD

Founding team member of AlphaDEX - the order book exchange platform for the Radix network