Bitcoin Forum
November 01, 2024, 05:01:17 PM *
News: Bitcoin Pumpkin Carving Contest
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1]
  Print  
Author Topic: Getting the "Current" ROI at the moment you have.  (Read 621 times)
NinjaBits (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10

Bitcoin Supporter


View Profile
April 23, 2017, 01:50:34 PM
 #1


Hello. I am coding a project, where I must programatically determine how much ROI (Return of Investment) you have reached every day.
I just need the correct formula, not the code Smiley

For example:

Investment: 0.1 BTC
Daily Percent: 2.4%
Days: 4
Current ROI: Huh

OR

Investment: 0.25 BTC
Daily Percent: 2.4%
Days: 18
Current ROI: Huh

Currently what I managed to come up is:

Code:
<?
$investment = 0.10;
$percent = 2.4;
$days = 10;
$earned = $investment + $days;
$ROI = ($investment * $earned) / 100;
?>

This formula gives me that ROI is: 0.1001% which can not be right. I would really appreciate for some1 to reveal the formula to calculate this (plain, not in code necesserally).

buwaytress
Legendary
*
Offline Offline

Activity: 2982
Merit: 3687


Join the world-leading crypto sportsbook NOW!


View Profile
April 23, 2017, 02:47:05 PM
 #2

Not sure what you're really asking for but ROI in your examples is simply gained by multiplying the daily  interest rate by the number of days.

So for eg. 1, ROI(%) is "daily interest" * "no.of days".
ie. 2.4*4 = 9.6%
The ROI expressed in bitcoin is 0.1*9.6/100


██
██
██
██
██
██
██
██
██
██
██
██
██
... LIVECASINO.io    Play Live Games with up to 20% cashback!...██
██
██
██
██
██
██
██
██
██
██
██
██
NinjaBits (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10

Bitcoin Supporter


View Profile
April 23, 2017, 04:11:45 PM
 #3

Not sure what you're really asking for but ROI in your examples is simply gained by multiplying the daily  interest rate by the number of days.

So for eg. 1, ROI(%) is "daily interest" * "no.of days".
ie. 2.4*4 = 9.6%
The ROI expressed in bitcoin is 0.1*9.6/100


Thank you for the answer.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!