Trading Asset tokens and the TWIN Finance protocol token

Trading within the TWIN Finance ecosystem involves both TWIN (long and short) asset tokens as well as the TWIN Finance protocol token. Here's an in-depth explanation of how trading works:

  1. Marketplace Structure: The TWIN marketplace functions as an automated-market-maker (AMM) market, with functionality similar to Uniswap V2, utilizing parts of its code. Each market pair is centered around a liquidity pool composed of USD stable coins and TWIN asset tokens. For each underlying asset (e.g., a stock, stock index, a commodity, a crypto coin) there are two separate market pools - one for the long token and one for the short token.

  2. Price Determination: The price of an asset in USD stable coins is determined by the formula:

π‘π‘Ÿπ‘–π‘π‘’=βˆ‘π‘ˆπ‘†π·π‘ π‘‘π‘Žπ‘π‘™π‘’π‘π‘œπ‘–π‘›π‘ /βˆ‘π‘Žπ‘ π‘ π‘’π‘‘π‘‡π‘œπ‘˜π‘’π‘›π‘ =𝑋/π‘Œπ‘π‘Ÿπ‘–π‘π‘’ = βˆ‘π‘ˆπ‘†π·π‘ π‘‘π‘Žπ‘π‘™π‘’π‘π‘œπ‘–π‘›π‘  / βˆ‘π‘Žπ‘ π‘ π‘’π‘‘π‘‡π‘œπ‘˜π‘’π‘›π‘  = 𝑋/π‘Œ
  1. Constant Product Invariant: TWIN market pools operate based on a constant product invariant, which means that the product of the number of tokens on each side of the pool remains constant during trading operations (buying/selling). The formula for this is:

Xβˆ—Y=kX*Y = k
  1. Pricing Adjustment: To maintain the constant product invariant, TWIN market prices dynamically adjust to ensure that the product of the pool's resulting balances closely matches the product calculated before the trade. This adjustment is based on the current balance of the pool's source asset 𝑋X and the balance of the target asset π‘ŒY:

XY=k=(X+Ain)(Yβˆ’Bout)XY=k=(X+Ain)(Yβˆ’B out)

To ascertain the appropriate value of 𝐡outBout​ given the trader's offered asset 𝐴𝑖𝑛Ain​:

Bout​=XAin/(Y+Ain)B out​ = XAin / (Y+A in)

The TWIN market can execute trades using only the current pool balances and the incoming token quantity. The market price is determined by encoding the ratio of the pool's target tokens to the source asset, commonly referred to as the pool ratio. The spread, which represents the difference between the executed trade and the current price, can be calculated as follows:

spread=max(yAin/(x+Ain)βˆ’yAin/X,0)spread = max(yAin / (x + Ain)- yAin/X,0)

As a pool accumulates significant liquidity from providers, the spread naturally diminishes, enabling the pool to execute trades much closer to its reported price of π‘Œ/𝑋.

  1. Liquidity Provider Commission: To compensate liquidity providers, the TWIN market imposes a Liquidity Provider (LP) Commission on each trade. This fee is then allocated back to the pool, serving as a reward for LP token holders. It can only be accessed by burning LP tokens and redeeming a portion of the pool. On TWIN Finance, each liquidity pool is subject to a fixed LP commission fee of 0.25%. This fee is assessed on the trader and is received in the form of asset tokens, TWIN, or USD stable coins, depending on the trade's direction.

  2. Governance Token Commission: In addition to the LP commission, a trading fee of 0.05% is applied. These funds are earmarked to support the TWIN protocol token holders and TWIN users, for example via the purchase of TWIN Finance protocol tokens on the internal TWIN market. The linkage between the TWIN Finance protocol token and the cash flows generated by the TWIN protocol ensures a dynamic connection between the token and the platform's financial activities.

Last updated