Bitcoin Forum
November 07, 2024, 08:24:17 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to calculate ROI  (Read 526 times)
MicroCode (OP)
Member
**
Offline Offline

Activity: 129
Merit: 24

Professional Developer


View Profile
April 22, 2017, 02:20:27 PM
 #1

Heyz!

I am here building a Bitcoin Website, but I stumbled across an issue. I need to make a PHP Formula, which returns CURRENT ROI (Percentage) for the moment.
For example: 100$ Investment and CURRENTLY earned 42$.

I need a formula, so I can programmatically calculate the ROI Percentage.

I did ofcourse try myself different version how I could achieve it, in a simple tests:

Code:
<?
$investment = 100;
$percent = 2.4;
$earned = 50;
$ROI = ($investment - $earned)/$investment; // Formula
echo 'Investment: '.$investment.'$<br />Percent: '.$percent.'%<br />Earned: '.$earned.'$<br /><b>ROI: '.$ROI.'%</b>';
?>

Please help me with the right formula. I am very bad when it comes to Percentage calcs.. ^^

HYIP Programmer - Designer - Admin - Manager
HYIP Script for Sale here:
https://bitcointalk.org/index.php?topic=4779840
MicroCode (OP)
Member
**
Offline Offline

Activity: 129
Merit: 24

Professional Developer


View Profile
April 22, 2017, 02:27:30 PM
 #2

Wait a second. I just tried to use this formula, and I think it might work.. but I need a confirmation from expert..

Code:
$ROI = ($investment * $earned)/100;

HYIP Programmer - Designer - Admin - Manager
HYIP Script for Sale here:
https://bitcointalk.org/index.php?topic=4779840
PremiumCodeX
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 531


Metaverse 👾 Cyberweapons


View Profile
April 23, 2017, 01:35:20 PM
 #3

Wait a second. I just tried to use this formula, and I think it might work.. but I need a confirmation from expert..

Code:
$ROI = ($investment * $earned)/100;

I think, it is

Code:
(($earned - $investment) / $investment)

, which gives a non-percent value.

And the percent value is

Code:
(($earned - $investment) / $investment) * 100

Where earned is the amount you have after earning...

[TUTORIAL] How to steal $350 000?
Best OS for recovering stolen BTCs.
Visit our FREE Bitcointalk thread.
cryptofirm
Sr. Member
****
Offline Offline

Activity: 1039
Merit: 250


BabelFish - FISH Token Sale at Sovryn


View Profile
April 24, 2017, 04:30:11 AM
 #4

Wait a second. I just tried to use this formula, and I think it might work.. but I need a confirmation from expert..

Code:
$ROI = ($investment * $earned)/100;

try this formula  Smiley

Code:
 %ROI = ($earned * 100) / $Investment 

i saw a few investments program use that formula
remember the ROI is in percent (%) not in $

regards

.
USD Stablecoin Aggregator
                                              ▄███████
                                            ▄█▀▄█████▀
              ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄      █▀▄███████
          ▄▄████████████████▄▄▀▀██████▄   ▄█ ███████
  ▄     ▄██▀▀▀▀█████████▄▀██████▄▄▀▀████  █████████▀
▄███▄ ▄███ █▀▀█ █████████▄█▀████████▄▄▀▀███████████
██ ▀███▀ █▄▀▀▀▀▄███ ██▀████▄▀████████▀███████████▀▀
██  ███████████████ ██ █████ ███▀▀▄▄▄██████████████
██▄██▀█████████████ ███ ███  ▄▄▄█████▀██▀▀█████████
 ▀█▀   ▀████████▀▀▄██▀ ▀▀▄▄██▄▄▀██▀▄▄██    ████████▄
         ▀█████▄█▀▀▀▄█████████▀▄▄▄███▀      ▀███████
               ▀▀▀███████████▄▄████▀          ██████▄
                                               ▀▀█████
BabelFish███████▄
▀█████▄▀█▄
 ███████▄▀█      ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  ███████ █▄   ▄██████▀▀▄▄████████████████▄▄
  ▀█████████  ████▀▀▄▄██████▀▄█████████▀▀▀▀██▄     ▄
   ███████████▀▀▄▄████████▀█▄█████████ █▀▀█ ███▄ ▄███▄
   ▀▀███████████▀████████▀▄████▀██ ███▄▀▀▀▀▄█ ▀███▀ ██
   ██████████████▄▄▄▀▀███ █████ ██ ███████████████  ██
   █████████▀▀██▀█████▄▄▄  ███ ███ █████████████▀██▄██
  ▄████████    ██▄▄▀██▀▄▄██▄▄▀▀ ▀██▄▀▀████████▀   ▀█▀
  ███████▀      ▀███▄▄▄▀█████████▄▀▀▀█▄█████▀
 ▄██████          ▀████▄▄████████████▀▀
█████▀▀
.
FISH token sale at Sovryn
████████████████████████████
████████████████████████████
████████████████████████████
████████▀▀▄██████▄▀▀████████
███████  ▀        ▀  ███████
██████                ██████
█████▌   ███    ███   ▐█████
█████▌   ▀▀▀    ▀▀▀   ▐█████
██████                ██████
███████▄  ▀██████▀  ▄███████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████████████████
█████████████████▀▀  ███████
█████████████▀▀      ███████
█████████▀▀   ▄▄     ███████
█████▀▀    ▄█▀▀     ████████
█████████ █▀        ████████
█████████ █ ▄███▄   ████████
██████████████████▄▄████████
████████████████████████████
████████████████████████████
████████████████████████████
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!