Published
Edited
Jun 28, 2020
1 star
Insert cell
Insert cell
Insert cell
Insert cell
kovan = protocol('kovan')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
kovanCompSpeedsBefore = cTokenMap(async c => (await kovan.Comptroller.methods.compSpeeds(c._address).call(kovanBlockBefore)) / 1e18, kovan)
Insert cell
kovanCompSpeedsAfter = cTokenMap(async c => (await kovan.Comptroller.methods.compSpeeds(c._address).call(kovanBlockAfter)) / 1e18, kovan)
Insert cell
kovanMarketTotalBorrowsesBefore = cTokenMap(async c => BigInt(await c.methods.totalBorrows().call(kovanBlockBefore)), kovan)
Insert cell
kovanMarketTotalBorrowsesAfter = cTokenMap(async c => BigInt(await c.methods.totalBorrows().call(kovanBlockAfter)), kovan)
Insert cell
Insert cell
ropsten = protocol('ropsten')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ropstenCompSpeedsBefore = cTokenMap(async c => (await ropsten.Comptroller.methods.compSpeeds(c._address).call(ropstenBlockBefore)) / 1e18, ropsten)
Insert cell
ropstenCompSpeedsAfter = cTokenMap(async c => (await ropsten.Comptroller.methods.compSpeeds(c._address).call(ropstenBlockAfter)) / 1e18, ropsten)
Insert cell
ropstenCompRateAfter = BigInt(await ropsten.Comptroller.methods.compRate().call(ropsten.blockNumberAfter))
Insert cell
ropstenMarketTotalBorrowsesAfter = cTokenMap(async c => BigInt(await c.methods.totalBorrows().call(ropstenBlockAfter)), ropsten)
Insert cell
ropstenPricesAfter = cTokenMap(async c => BigInt(await ropsten.PriceOracle.methods.getUnderlyingPrice(c._address).call(ropstenBlockAfter)), ropsten)
Insert cell
ropstenUtilities = cTokenMap(async (c, i) => ropstenMarketTotalBorrowsesAfter[i.symbol] * ropstenPricesAfter[i.symbol], ropsten)
Insert cell
ropstenTotalUtility = sum(ropstenUtilities)
Insert cell
ropstenCompSpeedsPredicted = cTokenMap(async (c, i) => Number(ropstenCompRateAfter * ropstenUtilities[i.symbol] / ropstenTotalUtility) / 1e18, ropsten)
Insert cell
ropstenCompSpeedsDeviation = cTokenMap(async (c, i) => ropstenCompSpeedsPredicted[i.symbol] - ropstenCompSpeedsAfter[i.symbol], ropsten)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more