Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created January 6, 2020 22:46
Show Gist options
  • Save BetterProgramming/db4cbc673d919e84cb02250b4e15eaea to your computer and use it in GitHub Desktop.
Save BetterProgramming/db4cbc673d919e84cb02250b4e15eaea to your computer and use it in GitHub Desktop.
for (let i = 0; i < numOfDays; i += freqInDays) {
const coinPrice = priceArr[i].price;
coinAmount += amountToInvest / coinPrice;
totalInvested += amountToInvest;
const total = coinAmount * coinPrice;
dataArr.push({
TotalInvested: totalInvested,
CoinAmount: coinAmount,
CoinPrice: coinPrice,
Total: total,
date: priceArr[i].date,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment