Created
January 27, 2021 13:15
-
-
Save ilonacodes/496c2f93b010ae88489ed23fc0a474cc to your computer and use it in GitHub Desktop.
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
const price = btcPrices[month]; | |
if (!price) { | |
invalidMonthRange(); | |
return; | |
} | |
const lastPrice = btcPrices.lastMonth; | |
console.log(`Price for month ${month} was ${price}`); | |
console.log(`While the price for the last month was: ${lastPrice}`); | |
const roi = (lastPrice - price) / price; | |
const grossProfit = roi * amount; | |
console.log(`Gross profit now would be: ${grossProfit}`); | |
console.log(`ROI: ${roi}`); | |
setGrossProfit(grossProfit); | |
setROI(roi); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment