YFX V2 White Paper

YFX.COM
5 min readApr 1, 2022

YFX V2 adopts the pricing model of a centralized oracle machine and P2Pool’s matchmaking mechanism, which is the orientation of user positions and the liquidity pool of market makers. At the same time, it uses the liquidity aggregation algorithm of UniSwap V3 to make the depth of market makers focus on a reasonable price range and improve the capital utilization rate of market makers.

The V2 version introduces the mechanism of funding fee to balance the market long-to-short ratio, reduce the risk of bare positions in the liquidity pool of market makers, optimize the taker trader position model, and implement a one-way position model, that is, taker traders only hold a one-way position.

In addition, V2 also realizes the function of conditional entrustment order and position take profit and stop loss, which reduces the trading risk of users.

The V2 core code is still implemented in the smart contract solidity, all the money management is still on the decentralized blockchain, and the platform cannot operate the user’s funds.

Liquidity Aggregation of Market Makers

In YFX V2, the market maker pool will simulate the liquidity management strategy of UniSwap V3 and distribute liquidity as reasonably as possible on the premise of ensuring the utilization of market-making funds. For this reason, we propose a liquidity index distribution algorithm, which is used to realize the distribution of market-making funds in the process of centralized quotation.

Tick management

Tick is a concept in Uniswap V3 introduced by us, which takes the current index price as the origin and divides the price range of 10% above and below the index price into ticks, with the minimum change as 1.0001tickSpace. Therefore, we can get the price range of nth buy and sell orders respectively. The price of each range is expressed by (Ps, Pe), P0 represents the index price, tickSpace = s, the nth interval represents the nth file of the buying and selling order when n > 0 indicates the buying order when n < 0 indicates the selling order, abs (n) > 0.

Distribution of market-making funds

Assuming that the total market-making funds are Y after leveraging, the nth tick uses the market-making funds of Yn to provide liquidity for users, and the cumulative funds of first N ticks from buy or sell orders is expressed by Sn, and the number of funds for each tick can be calculated by the following formula. (The b is the harmonic coefficient in the formula).

Transaction process

The user inputs the quantity ∆y to open a position, and according to the liquidity distribution of the market maker and the calculation process of Uniswap V3, get ∆x and trade.

Position Mode.

In one-way mode, the taker can only hold one position at most in a single market, either long or short. Multiple orders will be merged into the single position after be filled.

For example, Taker opened a long position of 1 ETH at the price of 3000 USDT/ETH with 10x leverage costs 300 USDT margin. Later, the trader executed another long order of 2 ETH at the price of 3010 USDT/ETH with a 602 USDT margin. The final merged position will be:

Open price: 3006.666 USDT/ETH.

Margin: 902 USDT.

Position Size: 3 ETH.

The leverage: 10x.

Funding Fees.

In YFX V1.0, there was no risk protection for the liquidity pool. The liquidity pool’s exposure positions are exposed to market volatility for long periods, resulting in larger risk to the liquidity pool. In V2, we will introduce a funding fee to balance the ratio of long-short positions in the liquidity pool, reduce the naked positions and lower the liquidity risk.

Traders will be required to pay or receive a funding fee when hold a position or liquidity when trading on the YFX.

The funding fee is calculated as follows.

Funding Fee = Position Value * Funding Fee Rate

Positive funding fees indicate that long position traders pay funding and short traders receive funding.

YFX V2 uses a decentralized calculation method to calculate the funding rate. Each time a user opens or closes a position, YFX V2 will update the global funding fee rate, and record the last updated time at the same time. Before the position operation, the funding fee rate for this period will be recorded on chain, and then accumulated and stored.

Formula for calculating the funding rate:

nlong : long position size of liquidity pool;

nshort : short position size of liquidity pool

The range of the funding fee ratio is [-0.375%, 0.375%] for every 8 hours.

Conditional Order

YFX V2 version will add the function of conditional order, which can meet the limit order function of traders. The Conditional Order will be triggered when it reaches the preset conditions. Traders need to specify a trigger price as a condition to activate the order. The users can select the latest market price to trigger the conditional order. This is an advanced order strategy that is more suitable for experienced traders. Every conditional order will be stored on chain and lock enough assets for margin and trading fee. On this basis, the function of taking profit and stopping loss for opened positions is added.

Take Profit and Stop Loss for Position

Considering the pump and dump of digital assets, we have added the function of position take profit and stop loss to V2. Users can easily set the take-profit and stop-loss condition for the position, and the platform will trigger the take-profit and stop-loss order when the price of the oracle machine reaches the preset price.

Summarize:

YFX V2 is an iteratively optimized version, and Cex users will become more and more accustomed to our trading method. The goal of V2 is also to combine the features of Cex and Dex, so that users can have the same trading experience as Cex in a decentralized network.

About YFX:

YFX.COM is a cross-chain decentralized perpetual contract platform based on Ethereum, Binance Smart Chain, Huobi Ecological Chain, TRON, OKEx public chain, and Polkadot. YFX provides up to 100 times the perpetual contract trading BTC, ETH and other assets. Different from the common automatic market maker model (AMM), YFX.COM adopts the QICAMM market maker pool trading method to provide users with high liquidity and low trading slippage. YFX.COM has successfully supported layer2’s perpetual contract trading function. YFX.COM’s goal is to build a DEX that can compete with CEXs on the derivatives trading track.

YFX official contact information:

Website: https://www.yfx.com/
Twitter: https://twitter.com/YFX_COM
Medium: https://yfxdefi.medium.com/
Telegram: https://t.me/YFX_COM
Discord: https://discord.gg/xwAtjpabC5
Youtube:https://youtube.com/channel/UCR4m3-VfO27aQy4yc2goZvA
Facebook:https://www.facebook.com/profile.php?id=100069836976785
Media Contact: media@yfx.com

--

--

YFX.COM

Decentralized Perpetual Exchange. Trade BTC, ETH and more with up to 200x leverage directly from your wallet at https://www.yfx.com.