forked from beefyfinance/beefy-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cb8bdf
commit f8b49c3
Showing
8 changed files
with
107 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true, | ||
"printWidth": 120, | ||
"printWidth": 100, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const axios = require('axios'); | ||
const { compound } = require('../../../utils/compound'); | ||
|
||
const getFortubeApys = async () => { | ||
let fortubeApys = {}; | ||
|
||
const resSimple = await axios.get(process.env.FORTUBE_REQ_TOKENS); | ||
const resExtended = await axios.get(process.env.FORTUBE_REQ_MARKETS, { | ||
headers: { | ||
authorization: process.env.FORTUBE_API_TOKEN, | ||
}, | ||
}); | ||
|
||
const dataSimple = resSimple.data; | ||
const dataExtended = resExtended.data.data; | ||
|
||
Object.values(dataSimple).map(item => { | ||
const symbol = item.symbol.toLowerCase(); | ||
const apy = compound(parseFloat(item.estimated_ar), process.env.FORTUBE_HPY, 1, 0.95); | ||
fortubeApys[`fortube-${symbol}`] = apy; | ||
}); | ||
|
||
dataExtended.map(item => { | ||
fortubeApys[`fortube-${item.token_symbol.toLowerCase()}`] += parseFloat( | ||
item.deposit_interest_rate | ||
); | ||
}); | ||
|
||
return fortubeApys; | ||
}; | ||
|
||
module.exports = getFortubeApys; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const getFryApys = require('./fry/getFryApys'); | ||
const getCakeApys = require('./pancake/getCakeApys'); | ||
const getCakePoolApy = require('./pancake/getCakePoolApy'); | ||
const getCakeLpApys = require('./pancake/getCakeLpApys'); | ||
const getFortubeApys = require('./fortube/getFortubeApys'); | ||
|
||
const getApys = async () => { | ||
let apys = {}; | ||
const values = await Promise.all([ | ||
getFryApys(), | ||
getCakeApys(), | ||
getCakePoolApy(), | ||
getCakeLpApys(), | ||
getFortubeApys(), | ||
]); | ||
|
||
for (item of values) { | ||
apys = { ...apys, ...item }; | ||
} | ||
|
||
return apys; | ||
}; | ||
|
||
module.exports = getApys; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters