Stakedllc / robo-advisor-yield

The Robo-Advisor for Yield
https://staking.staked.us/ray
Other
45 stars 15 forks source link

Jare's Proposal Nine for Yield Generating Opportunity: Literally Free Money (0% APR) Borrowing #11

Open staccDOTsol opened 4 years ago

staccDOTsol commented 4 years ago

Why

Everyone wants free money. It takes money to make money. How can DeFi give us free money, now instead of later?

Solution

@dpurhar27

If you identify the lowest APR borrow stable on Compound, then calculate the average supply APR of the rest, you can index a fair share of moonable coins and then figure out the breakeven of %s to basically borrow a value at 0%. I would envision a UI that allows one to uncheck/recheck chosen coins to index or not, a button to rebalance based on speculative gains of non-stables gaining/losing over a course of x amount of time, and a deposit whatevercoin with a backend that radarrelays into all the coins. This would be even better if indexed borrow/supply among more DeFi.

var request = require('request')

async function doIt(){
    request({
    headers: {
      'x-api-key': process.env.key
    },
    uri: 'https://api.loanscan.io/v1/interest-rates',
    method: 'GET'
  }, function (err, res, body) {
    b=JSON.parse(body)[7]
    var lowest = 9999999;
    var winner;
    for (var s in b['borrow']){
        if (b['borrow'][s].symbol == 'DAI' || b['borrow'][s].symbol == 'SAI' || b['borrow'][s].symbol == 'USDC'){
            if (b['borrow'][s].rate < lowest){
                lowest = b['borrow'][s].rate
                winner = b['borrow'][s].symbol
            }
        }
    }
    var t = 0;
    var c = 0;
    var symbols = []
    for (var s in b['supply']){
        if (b['supply'][s].symbol != winner){
                symbols.push(b['supply'][s].symbol)
                t += b['supply'][s].rate
                c++

        }
    }
    var avg = t / c
    console.log(winner + ' wins with: ' + (lowest * 100).toPrecision(4)+ '%')
    console.log('average supply % APR: ' + (avg * 100).toPrecision(4)+ ' %')
    var equity = 1000
    var ratio = avg / lowest
    var supplied =  equity * ratio
    console.log('At present rates, for every $1000 USD as collateral you can borrow ' + supplied.toPrecision(4) + '$ and pay an average of 0% APR')
    console.log('You\'d be holding:')
    console.log(symbols)
  });

}
doIt()

image

Considerations

More defi solutions, more loans, more rewards. Team's funds would come from a % of the supplied funds' interest.

Additional Info

I can code this if I had a budget to play around with tokens/stables.

staccDOTsol commented 4 years ago

Look it outperforms itself in terms of less risk, more exposure and even finding some better rates to allow for a larger max. amount to achieve net-net 0% debt.

image