Vault.getTokenValue()
at timestamp
Timestamp at which vault was deployed or any timestamp before the first position is opened
1 Year in seconds
VaultToken.balanceOf(u)
where u
is the address of the user
= Dollar value of the token at timestamp
- Vault performance between 2 timestamps and
- Vault performance at timestamp since inception
Let be the vault performance between timestamps and and & be the corresponding APR & APY
- Number of periods required to complete a year
Let be the total of value held by the user in vault at timestamp in the deposit token , and be its corresponding value in Dollars ($)
Let be the sum of all value depositted by the user to the vault , and be the sum of all value withdrawn by the user to the vault
Thus yield earned (in deposit token ) by the user in vault is
Corresponding value in dollar terms
Following will give the total dollar value held by the user across all vaults
to are different vaults
ROI is a bit tricky to calculate
Let be the timestamp in which the user first deposits to the vault , and user does a deposit or withdraw events in the following timestamps , ,…,
Let be the shares held by the user in Vault between timestamps and
Given that, ROI of the user in vault can be calculated by,
In the above equation is the token value of the vault at timestamp
Let be the total value user holds in the vault at timestamp and no deposit/withdraw occurs till timestamp , then total yield earned by the user is
Use Vault.totalFunds() + Vault.totalQueuedDeposits()
Vault.totalQueuedDeposits()
is invalid for Basis Trading Vault, so use Vault.totalFunds()
for Basis Trading Vault
From the contracts point of view, the vaults do not have maximum capacity. Instead this will be an off-chain value and when the vaults reach this value in deposits, it'll be paused for deposits.
All vaults have events for opening a position (OpenPosition
) and closing a position (ClosePosition
). Read the Natspec Documentation of these events for further details.
Further, Call Selling and Put Selling vaults have two additional events. One for adding additional collateral (AddCollateral
) and one for settling options (SettleOption
). Again please refer to the event documentations in the contracts repo. Example - Call Selling Vault
For the logic behind clubbing the event, please co-ordinate with Gautham and Abhishek. In my opinion, every event with the same strike ID can be clubbed together for Call Selling and Put Selling. Clubbing wouldn't make much sense for Gamma Vault and Basis Trading Vault.
Vault.totalFunds()
is the total funds under management.
Vault.usedFunds()
is the total amount of funds being used for trading, managing etc…
Vault.liveStrikes()
returns an array of strike IDs in which the vault have a position
Vault.positionDatas(strikeId)
returns the position data of the strike ID strikeId
. It returns the following data:
positionId
- Corresponding Lyra Position ID
amount
- Total amount of short position
collateral
- Total collateral used for the position
premiumCollected
- Total premium collected from this position, and this can be negative if the vault closes a position at a loss but not yet settled
Vault.positionData()
returns the following data
strikeId
- Current Strike ID being traded by the vault
positionId
- Corresponding position ID
optionAmount
- Amount of options held by the vault of strikeId
premiumPaid
- Premium paid by the vault to purchase total amount of options
shortAmount
- Amount of short position held by the vault in the underlying asset
totalMargin
- Margin or collateral being used for holding the short position
Vault.positionSize()
will return the amount of short position in futures market held by the vault. Also vault will hold equal amount of underlying asset as well.
Margin will need to calculated from the Synthetix futures market contract. Will be included in the resolver.
Delta of the option with specific strikeId
need to be calculated from the Lyra contracts. This will be included in the resolver.
One short position () will have a delta of
Total delta of the Gamma Vault can be calculated by the following
where optionAmount
, shortAmount
and delta of the option