Trading Principles & Pricing
For each trading pair, there is a fund pool on VFX V2. The fund pool is the direct counterparty to traders. If traders make a profit that comes from the fund pool. On the other hand, liquidity providers will make a profit if the LP token's net value when removing liquidity is higher than that when adding liquidity.
YFX offers linear, inverse, and mixed contracts for trading.

There are two steps involved in opening/closing/editing a position:
- 1.The user sends a transaction request to the blockchain, including parameters like margin amount and leverage.
- 2.Keepers observe the blockchain for the request, retrieve the price feed from the centralized oracle, then execute the request.
The price feed from the centralized oracle is the weighted average of three major centralized exchanges.
There are many ways to obtain prices on the blockchain, but each has some problems.
Price Feeds | Existing Problems |
---|---|
Chainlink & other oracles |
|
Uniswap AMM protocol |
|
The weighted average price on centralized exchanges |
|
YFX V1 and V2 take the weighted average price on centralized exchanges.
V3 mainly uses Chainlink price feeds, supplemented by the latest price on centralized exchanges.
The index price is the weighted average price on centralized exchanges. The USD index price comes from USD exchanges like Coinbase, Kraken, and Bitstamp, and the USDT index price mainly comes from USDT exchanges like Binance, Huobi, OKX, and Gate.
// Some code
Index Price = (A's Quotation × A's Weight) + (B's Quotation × B's Weight) + (C's Quotation × C's Weight)
YFX will temporarily remove exchanges from index price calculation when the following conditions are met:
- 1.The latest exchange quotation has not changed for more than 1 minute.
- 2.The exchange quotation deviates more than 3% from the average of the other four quotations.
Dernière mise à jour 4mo ago