efx-api-node
Version:
<img src="https://avatars3.githubusercontent.com/u/33315316?s=200&v=4" align="right" />
20 lines (15 loc) • 469 B
JavaScript
const getCandle = require('./getCandle')
/**
* We will always return 1 USD for stable coins
*/
const stableCoins = require('./stableCoins')
module.exports = async (token, timeframe, timestamp ) => {
if (stableCoins[token]) {
return stableCoins[token]
}
timestamp = timestamp || Date.now()
timeframe = timeframe || '1h'
const candle = await getCandle(token, timestamp, timeframe)
// return the open price for the 1 Hour candle
return candle[2]
}