Skip to content

Instantly share code, notes, and snippets.

@ilonacodes
Created January 27, 2021 13:15
Show Gist options
  • Save ilonacodes/496c2f93b010ae88489ed23fc0a474cc to your computer and use it in GitHub Desktop.
Save ilonacodes/496c2f93b010ae88489ed23fc0a474cc to your computer and use it in GitHub Desktop.
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