Giter VIP home page Giter VIP logo

igain's Introduction

IGainAAVEIRS.sol

Introduction

The settlement price of Long Token is determined by the deposit interest rate in the term period on AAVE platform. The more the interest accumulates, the higher (lower) the price of Long (Short) Token is.

Purchasing Long Token means take a long position on future interest rate; in contrast, buying Short Token indicates holding a short position on future interest rate.

Price Settlement

AAVE.getReserveNormalizedVariableDebt(asset) Returns the normalized variable debt per unit of asset.

This is the exchange rate of the tokenized variable debt and the value increases with the growth of the floating interest rate.

  1. Save real-time exchange rate as initializing smart contract
initialRate = AAVE.getReserveNormalizedVariableDebt(asset)
  1. Record real-time exchange rate on settlement day
endRate = AAVE.getReserveNormalizedVariableDebt(asset);
  1. With initialRate and endRate, the growth of the floating deposit interest rate in the period can be calculated with percernt form ratio
ratio = (endRate - initialRate) / initialRate

For example, if the ratio on the expiry day is 0.04, then it can be deduced that the interest rate is 4%. Settled with 4% interest rate, the Long Token is priced as $0.04 while the Short Token should be $0.96.

  1. To increase capital efficiency, adopt appropriate leverage according to backtesting history data

As above stated, if with 10x leverage, then the Long Token is settled with the price of $0.4 while the Short Token should be $0.6.

_bPrice = leverage * rate

Long is settled as bPrice

bPrice = min(_bPrice, 1) # Max. Price of Long is $1

Shoer = 1 - bPrice


IGainYearnIRS.sol

Introduction

The mechanism and calculation of IGainYearnIRS.sol is exactly the same as IGainAAVEIRS, and the only different part is to replace AAVE interest rate with Yearn interest rate.

-> AAVE.getReserveNormalizedVariableDebt(asset) replaces withvault.pricePerShare()


IGainDelta.sol

Introduction

The mechanism of IGainDelta.sol is similar to the binary option in crypto price, but the payoff of the Long Token does not comply with all-or-none law. The settled price of Long Token will gradually go up from $0 to $1. As the leverage is larger, the liquidity is becoming more intensive.

Price Settlement

y:Settled Price of Long Token, bPrice = calcDelta()
x:Crypto Price on Settlement Date, closePrice
a:Price on initialization, anchor = openPrice
l:Leverage, lever

As the leverage (l) is larger, the horizontal compression occurs and the function's base graph is shrunk along the x-axis. Therefore, the liquidity values move in closer and closer to the centre, which is known as the starting price. In addition, to the same settlement price, the difference between the centre and the strike price will be inversely proportional to the leverage (l).

As l = ∞, the curve is a step function.

igain's People

Contributors

artistic709 avatar

Stargazers

Štefan Nebesňák Jr. avatar Ludmila avatar Leofis G avatar yuhao avatar

Watchers

James Cloos avatar  avatar

Forkers

omprakashtk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.