Main Concepts
The main concepts of the TurboSwap marginal trading protocol.
Last updated
Was this helpful?
The main concepts of the TurboSwap marginal trading protocol.
Last updated
Was this helpful?
Every user of the TurbosSwap protocol has an account where positions are recorded. Accounts are identified by a unique address in the blockchain where the protocol operates, i.e. Ethereum, Binance Chain, capable of running smart contracts.
For each user asset, positions are either positive (long), negative (short), or zero (void). A positive position means that the protocol owes the asset to the user. A negative position means the user owes the asset to the protocol. In other words, positive positions reflect assets deposited by the users to the protocol, while negative positions reflect assets borrowed by the users from the protocol. A position is identified by an account ID (user's address) and an asset ID.
We will use to denote the position of theuser in the asset.
The protocol itself may own assets by itself. The assets owned by the protocol are called reserves.
We will use to denote the amount of assets owned by the protocol.
The capital is basically the net value of all the protocol assets. More formally it is the value of all the reserves minus the sum of all the positions. The contribution of the asset into the capital (denoted as ) is:
The capital value (denoted as ) denominated in the base currency is:
The protocol continuously collects interest on all the negative (short) positions opened by the users. The interest is collected by increasing the absolute value of a position according to the well known compound interest formula:
The protocol charges a small fee from all the collected borrow interest, and proportionally distributes the rest among those users whose positions in the corresponding assets are positive (long). The protocol ensures that the effective deposit interest rate for an asset never exceeds the borrow rate for this asset discounted by the fee.
So the interest amount (before fee) to be distributed among deposit holders is:
or, which is the same:
Here
So,
Here is the current price of the asset denominated in the base currency.
Hereis the initial time,is the current time, andis the borrowed interest rate for theasset.
Consider to be the sum of all the negative (short) positions in the asset and to be the sum of all the positive (long) positions in the same asset. Note, that these two values could be calculated as:
The total interest collected during a period of time from till on all the negative (short) positions in asset is:
For the effective deposit rate being equal to the borrow rate, the total deposit interest (before fee) is:
Note, that these formulas work correctly only if the graphs ofand don't cross inside the time interval fromto.
Ifis the interest rate fee, the the amount of the net interest to be distributed is:
For a positive (long) position , the share in the collected borrow interest is:
if the graphs ofand do intersect, the intersection point could be found from the following equation:
For the asset, the effective deposit rate could be found from the following equation:
When the total notional amount of all the long positions exceeds the total notional amount of all the short positions, then the effective deposit rate depends on the borrow interest rate, the interest rate fee, and the short-to-long ratio . Otherwise, it depends only on the deposit rate and the fee.