Ethereum Mining Profitability Calculator

Network Hashrate: GH/s

[insert_php]
echo $_POST[‘name’];
$heute = date(“H:i:s”);
echo $heute.’
‘;

#Ethereum Stuff
$url = ‘https://etherchain.org/api/basic_stats’;
$json = file_get_contents($url);
$retVal = json_decode($json, TRUE);

$heute = date(“H:i:s”);
echo $heute.’
‘;

#Ethereum Stuff
$price = $retVal[‘data’][‘price’][‘usd’];
$blocktime = $retVal[‘data’][‘stats’][‘blockTime’];
$difficulty = $retVal[‘data’][‘stats’][‘difficulty’];
$hashRate = $retVal[‘data’][‘stats’][‘hashRate’];

$heute = date(“H:i:s”);
echo $heute.’
‘;

echo “1 ETH is worth: “.$price.”$ “.”
“;
echo $blocktime.”
“;
echo $difficulty.”
“;
echo $hashRate.”
“;

$heute = date(“H:i:s”);
echo $heute.’
‘;

if (isset($_POST[‘AmountWantToTrade’])) $AmountWantToTrade= $_POST[‘AmountWantToTrade’];
if (isset($_POST[‘valueCurrency’])) $valueCurrency= $_POST[‘valueCurrency’];
if (isset($_POST[‘Desire’])) $Desire= $_POST[‘Desire’];
$answer = $valuea * $valueb – $valuec + $AmountWantToTrade;

$heute = date(“H:i:s”);
echo $heute.’
‘;

echo <<<_END

_END;
?>

Buy/Sell Calculator
You want to Number of BTC For
The answer is: ‘;

#Get Currency the user wants to trade
$Currency = $valueCurrency;

#Get Cashila Countires Data
$jsonCountries = file_get_contents(‘https://www.cashila.com/api/v1/supported-countries’);
#Do an Array
$retValCountries = json_decode($jsonCountries, TRUE);
echo “alt”;
$Country= $retValCountries [‘result’][1][‘code’];
echo $Country.”
“;

$key = array_search(‘AS’, array_column($retValCountries , ‘code’));
$Country= $retValCountries [‘result’][$key][‘name’];
echo $Country.”
“;

#Get the right Currency API – Currently only EUR!
if ($Currency == “EUR”)
{
$heute = date(“H:i:s”);
echo $heute.’Langsam 1.1?
‘;

$jsonCashilaEur = file_get_contents(‘https://www.cashila.com/api/v1/exchange-rate/eur’);
$retValCashilaEur = json_decode($jsonCashilaEur, TRUE);
$CashilaBuy = $retValCashilaEur [‘result’][‘buy_rate’];
$CashilaSell = $retValCashilaEur [‘result’][‘rate’];
$CashilaFee = 0.01;

$heute = date(“H:i:s”);
echo $heute.’Langsam 1.2?
‘;
}

else
{
$CashilaBuy = 0;
$CashilaSell=0;
$CashilaFee = 0.00;
echo “Currency not supported at Cashila!”;
};

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
#New Calc
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $CashilaBuy – ($CashilaFee * $AmountWantToTrade * $CashilaBuy);
echo “YouWillNeedToPayOrReceive ” .”
“;
echo $YouWillNeedToPayOrReceive .”
“;

$CashilaPrice = $CashilaBuy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $CashilaSell – $CashilaFee * $AmountWantToTrade * $CashilaSell;
echo “YouWillNeedToPayOrReceive ” .”
“;
echo $YouWillNeedToPayOrReceive .”
“;
$CashilaPrice = $CashilaSell;
};

#Start Filling Array
$DATA= array(
array($YouWillNeedToPayOrReceive,”$Currency”, “$Desire”, “Cashila”, $CashilaPrice)
);

$heute = date(“H:i:s”);
echo $heute.’
‘;

#Code CEX.io
$jsonCEX = file_get_contents(‘https://cex.io/api/tickers/USD/EUR/RUB/BTC’);
$retValCEX = json_decode($jsonCEX, TRUE);
$CEXFee = 0.01;

#Get the right Currency API Data

if ($Currency == “EUR”)
{
$heute = date(“H:i:s”);
echo $heute.’Langsam 1.3?
‘;

$CEXBuy = $retValCEX [‘data’][3][‘last’];
$CEXSell = $retValCEX [‘data’][3][‘last’];

$heute = date(“H:i:s”);
echo $heute.’Langsam 1.4?
‘;
}

elseif ($Currency == “USD”)
{
$heute = date(“H:i:s”);
echo $heute.’Langsam 1.5?
‘;

$CEXBuy = $retValCEX [‘data’][0][‘last’];
$CEXSell = $retValCEX [‘data’][0][‘last’];
}

else
{
$CEXBuy = 0;
$CEXSell =0;
echo “Currency is not supported at CEX.io!”;
};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $CEXBuy – ($CEXFee * $AmountWantToTrade * $CEXBuy);
$CEXPrice = $CEXBuy ;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $CEXSell – $CEXFee * $AmountWantToTrade * $CEXSell ;
$CEXPrice = $CEXSell ;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive,”$Currency”, “$Desire”, “CEX.io”, $CEXPrice));

$heute = date(“H:i:s”);
echo $heute.’
‘;

#Code Coinbase.com
#Get the right Currency API
if ($Currency == “EUR”)
{
if ($Desire == “BUY”)
{
$jsonCoinbase = file_get_contents(‘https://api.coinbase.com/v2/prices/BTC-EUR/buy’);
}
else {$jsonCoinbase = file_get_contents(‘https://api.coinbase.com/v2/prices/BTC-EUR/sell’);};}
elseif ($Currency == “USD”)
{
if ($Desire == “BUY”)
{
$jsonCoinbase = file_get_contents(‘https://api.coinbase.com/v2/prices/BTC-USD/buy’);
}
else {$jsonCoinbase = file_get_contents(‘https://api.coinbase.com/v2/prices/BTC-USD/sell’);};}

else
{
$CoinbaseBuy = 0;
$CoinbaseSell =0;
echo “Currency is not supported at Coinbase!”;
};

$retValCoinbase = json_decode($jsonCoinbase, TRUE);
$CoinbaseBuy = $retValCoinbase [‘data’][‘amount’];
$CoinbaseSell = $retValCoinbase [‘data’][‘amount’];
#Depends on the Country!!!! Not finished
$CoinbaseFee = 0.00;

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $CoinbaseBuy – ($CoinbaseFee * $AmountWantToTrade * $CoinbaseBuy);
$CoinbasePrice = $CoinbaseBuy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $CoinbaseSell – $CoinbaseFee* $AmountWantToTrade * $CoinbaseSell ;
$CoinbasePrice = $CoinbaseSell;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “Coinbase”, $CoinbasePrice));

$heute = date(“H:i:s”);
echo $heute.’
‘;

#Code bitx.co
#Get the right Currency API

$jsonBitx = file_get_contents(‘https://api.mybitx.com/api/1/tickers’);
$retValBitx = json_decode($jsonBitx, TRUE);
#Currencies they have: Trading pairs: BTC/ZAR, BTC/MYR, BTC/KES, BTC/NGN

$BitxFee = 0.0030;

if ($Currency == “ZAR”)
{
$BitxBuy = $retValBitx [‘tickers’][4][‘last_trade’];
$BitxSell = $retValBitx [‘tickers’][4][‘last_trade’];
}
elseif ($Currency == “IDR”)
{
$BitxBuy = $retValBitx [‘tickers’][0][‘last_trade’];
$BitxSell = $retValBitx [‘tickers’][0][‘last_trade’];
}
else
{
$BitxBuy = 0;
$BitxSell = 0;
$BitxFee = 0;

};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)
if ($BitxBuy != 0)
{
if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $BitxBuy – ($BitxFee * $AmountWantToTrade * $BitxBuy );
echo “Currency is not supported at BITXXX!”;
$BitxPrice = $BitxBuy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $BitxSell – $BitxFee * $AmountWantToTrade * $BitxSell;
echo “Currency is not supported at BITYYYY!”;
$BitxPrice = $BitxSell ;
};
echo “Currency is not supported at BITZZZ!”;;
}

else{$YouWillNeedToPayOrReceive = ‘999999 FAIL’;};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “Bitx”, $BitxPrice));

$heute = date(“H:i:s”);
echo $heute.’
‘;

#Code Bter.com
#API DOC: https://bter.com/api
if ($Currency == “CNY”)
{
$Fee = 0.02;
if ($Desire == “BUY”)
{
$jsonAPI = file_get_contents(‘http://data.bter.com/api/1/ticker/btc_cny’);
}
else {$jsonAPI = file_get_contents(‘http://data.bter.com/api/1/ticker/btc_cny’);};}
elseif ($Currency == “AAAA”)
{
if ($Desire == “BUY”)
{
$jsonAPI = file_get_contents(‘http://data.bter.com/api/1/ticker/btc_cny’);
}
else {$jsonAPI = file_get_contents(‘http://data.bter.com/api/1/ticker/btc_cny’);};}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at Bter.com!”;
};

$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘result’][‘sell’];
$Sell = $retValAPI [‘result’][‘buy’];

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy – ($Fee * $AmountWantToTrade * $Buy);
$Price = $Buy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Sell – $Fee* $AmountWantToTrade * $Sell ;
$Price = $Sell;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “Bter”, $Price));

#Code BitMEX
#API DOC: https://www.bitmex.com/app/restAPI and https://www.bitmex.com/api/explorer/

#?????
$Fee = 0.01;
if ($Currency == “USD”)
{

if ($Desire == “BUY”)
{
$jsonAPI = file_get_contents(‘https://www.bitmex.com/api/v1/quote?symbol=XBTUSD&count=10&start=0&reverse=true’);
}
else {$jsonAPI = file_get_contents(‘https://www.bitmex.com/api/v1/quote?symbol=XBTUSD&count=10&start=0&reverse=true’);};}
elseif ($Currency == “AAAA”)
{
if ($Desire == “BUY”)
{
$jsonAPI = file_get_contents(‘http://data.bter.com/api/1/ticker/btc_cny’);
}
else {$jsonAPI = file_get_contents(‘http://data.bter.com/api/1/ticker/btc_cny’);};}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at BitMEX.com!”;
};

$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘askPrice’];
$Sell = $retValAPI [‘bidPrice’];

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy – ($Fee * $AmountWantToTrade * $Buy);
$Price = $Buy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Sell – $Fee* $AmountWantToTrade * $Sell ;
$Price = $Sell;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “BitMex”, $Price));

#Code https://coinsecure.in
#API DOC: https://www.bitmex.com/app/restAPI and https://www.bitmex.com/api/explorer/

if ($Currency == “INR”)
{

$jsonAPI = file_get_contents(‘https://api.coinsecure.in/v0/noauth/ticker’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Sell = $retValAPI [‘result’][‘highestBid’];
$Buy = $retValAPI [‘bidPrice’][‘lowestAsk’];

}
elseif ($Currency == “USD”)
{

$jsonAPI = file_get_contents(‘https://api.coinsecure.in/v0/noauth/ticker’);
$retValAPI = json_decode($jsonAPI, TRUE);
$ExchangeRateUSD = 1;
$ExchangeRateUSD = $retValAPI [‘result’][‘USDRate’];
$Sell = ($retValAPI [‘result’][‘highestBid’] / $ExchangeRateUSD) * 1000*0.997 ;
$Buy = ($retValAPI [‘result’][‘lowestAsk’] / $ExchangeRateUSD) * 1000*0.997;

}

elseif ($Currency == “EUR”)
{

$jsonAPI = file_get_contents(‘https://api.coinsecure.in/v0/noauth/ticker’);
$retValAPI = json_decode($jsonAPI, TRUE);
$ExchangeRateUSD = 1;
$ExchangeRateUSD = $retValAPI [‘result’][‘EURRate’];
echo “HAHAHAHAHAHHA!”;
echo $ExchangeRateUSD;
$Sell = ($retValAPI [‘result’][‘highestBid’] / $ExchangeRateUSD) * 1000*0.997;
$Buy = ($retValAPI [‘result’][‘lowestAsk’] / $ExchangeRateUSD) * 1000*0.997;

}

elseif ($Currency == “CNY”)
{

$jsonAPI = file_get_contents(‘https://api.coinsecure.in/v0/noauth/ticker’);
$retValAPI = json_decode($jsonAPI, TRUE);
$ExchangeRateUSD = $retValAPI [‘result’][‘CNYRate’];
$Sell = ($retValAPI [‘result’][‘highestBid’] / $ExchangeRateUSD) * 1000*0.997 ;
$Buy = ($retValAPI [‘bidPrice’][‘lowestAsk’] / $ExchangeRateUSD) * 1000*0.997;

}
elseif ($Currency == “GBP”)
{

$jsonAPI = file_get_contents(‘https://api.coinsecure.in/v0/noauth/ticker’);
$retValAPI = json_decode($jsonAPI, TRUE);
$ExchangeRateUSD = $retValAPI [‘result’][‘GBPRate’];
$Sell = ($retValAPI [‘result’][‘highestBid’] / $ExchangeRateUSD) * 1000*0.997 ;
$Buy = ($retValAPI [‘bidPrice’][‘lowestAsk’] / $ExchangeRateUSD) * 1000*0.997;

}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at coinsecure.in!”;
};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy;
$Price = $Buy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Sell;
$Price = $Sell;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “Coinsecure”, $Price));

#Code unocoin.com
#API DOC: https://www.unocoin.com/tickerapi

if ($Currency == “INR”)
{

$jsonAPI = file_get_contents(‘https://www.unocoin.com/trade?all’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Sell = $retValAPI [‘sell’];
$Buy = $retValAPI [‘buy’];
$Fee = 0.01;
}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at unocoin.com!”;
};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy – ($Fee * $AmountWantToTrade * $Buy);
$Price = $Buy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Sell – ($Fee * $AmountWantToTrade * $Sell);
$Price = $Sell;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “unocoin.com”, $Price));

#Code 247exchange.com
#API DOC: https://www.247exchange.com/developers

$Fee = 0.02;
if ($Currency == “USD”)
{

$jsonAPI = file_get_contents(‘https://www.247exchange.com/api/ticker/’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘result’][‘BTC_USD’][‘currentBuy’];
$Sell = $retValAPI [‘result’][‘BTC_USD’][‘currentSell’];

}
elseif ($Currency == “EUR”)
{
$jsonAPI = file_get_contents(‘https://www.247exchange.com/api/ticker/’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘result’][‘BTC_EUR’][‘currentBuy’];
$Sell = $retValAPI [‘result’][‘BTC_EUR’][‘currentSell’];

}

elseif ($Currency == “GBP”)
{

$jsonAPI = file_get_contents(‘https://www.247exchange.com/api/ticker/’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘result’][‘BTC_GBP’][‘currentBuy’];
$Sell = $retValAPI [‘result’][‘BTC_GBP’][‘currentSell’];

}

elseif ($Currency == “AUD”)
{

$jsonAPI = file_get_contents(‘https://www.247exchange.com/api/ticker/’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘result’][‘BTC_AUD’][‘currentBuy’];
$Sell = $retValAPI [‘result’][‘BTC_AUD’][‘currentSell’];

}
elseif ($Currency == “CZK”)
{

$jsonAPI = file_get_contents(‘https://www.247exchange.com/api/ticker/’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘result’][‘BTC_CZK’][‘currentBuy’];
$Sell = $retValAPI [‘result’][‘BTC_CZK’][‘currentSell’];
}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at coinsecure.in!”;
};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy – ($Fee * $AmountWantToTrade * $Buy);
$Price = $Buy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Sell – ($Fee * $AmountWantToTrade * $Sell);
$Price = $Sell;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “247exchange”, $Price));

#Code https://anycoindirect.eu/en (tuka da napi6em review, i da im kajem za da ni adnat na homepaga!)
#API DOC: https://anycoindirect.eu/en/home/api

#Everything depends on the Payment method!!!
if ($Currency == “EUR”)
{

if ($Desire == “BUY”)
{
$jsonAPI = file_get_contents(‘https://anycoindirect.eu/api/public/buyprices?CoinCode=BTC&FiatCode=EUR&CoinAmount=1’);
}
else {$jsonAPI = file_get_contents(‘https://anycoindirect.eu/api/public/sellprices?CoinCode=BTC&FiatCode=EUR&CoinAmount=1’);};}
elseif ($Currency == “CAD”)
{
if ($Desire == “BUY”)
{
$jsonAPI = file_get_contents(‘https://anycoindirect.eu/api/public/buyprices?CoinCode=BTC&FiatCode=CAD&CoinAmount=1’);
}
else {$jsonAPI = file_get_contents(‘https://anycoindirect.eu/api/public/sellprices?CoinCode=BTC&FiatCode=CAD&CoinAmount=1’);};}

else
{
$Price = 0;

echo “Currency is not supported at Any Coin Direct!”;
};

$retValAPI = json_decode($jsonAPI, TRUE);
$Price = $retValAPI [‘Data’][1][‘FiatAmount’];

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Price;

}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Price ;

};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “anycoindirect.eu”, $Price));

https://bitit.gift/ticker

#Code bitit.gift
#API DOC: https://bitit.gift/ticker

$Fee = 0.0375;
if ($Currency == “USD”)
{

$jsonAPI = file_get_contents(‘https://bitit.gift/ticker’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘USD’][‘btc_rate’];
$Sell = 0;

}
elseif ($Currency == “GBP”)
{
$jsonAPI = file_get_contents(‘https://bitit.gift/ticker’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘GBP’][‘btc_rate’];
$Sell = 0;

}

elseif ($Currency == “EUR”)
{

$jsonAPI = file_get_contents(‘https://bitit.gift/ticker’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘EUR’][‘btc_rate’];
$Sell = 0;

}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at bitit.gift!”;
};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy – ($Fee * $AmountWantToTrade * $Buy);
$Price = $Buy;
}
else
#They offer only BUY Bitcoin
{
$YouWillNeedToPayOrReceive = 0;
$Price = 0;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “Bitit”, $Price));

#Code Bitfinex
#API DOC: http://docs.bitfinex.com/#introduction

$Fee = 0.001;
if ($Currency == “USD”)
{

$jsonAPI = file_get_contents(‘https://api.bitfinex.com/v1/pubticker/BTCUSD’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘ask’];
$Sell = $retValAPI [‘bid’];

}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at bitfinex!”;
};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy – ($Fee * $AmountWantToTrade * $Buy);
$Price = $Buy;
}
else
#They offer only BUY Bitcoin
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Sell- ($Fee * $AmountWantToTrade * $Sell);
$Price = $Sell;
};

#Code exmo.com/en
#API DOC: https://exmo.com/en/api_doc

$Fee = 0.002;
if ($Currency == “USD”)
{

$jsonAPI = file_get_contents(‘https://api.exmo.com/v1/ticker/’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘BTC_USD’][‘buy_price’];
$Sell = $retValAPI [‘BTC_USD’][‘sell_price’];

}
elseif ($Currency == “EUR”)
{

$jsonAPI = file_get_contents(‘https://api.exmo.com/v1/ticker/’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘BTC_EUR’][‘buy_price’];
$Sell = $retValAPI [‘BTC_EUR’][‘sell_price’];

}

elseif ($Currency == “RUB”)
{

$jsonAPI = file_get_contents(‘https://api.exmo.com/v1/ticker/’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘BTC_RUB’][‘buy_price’];
$Sell = $retValAPI [‘BTC_RUB’][‘sell_price’];

}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at exmo.com!”;
};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy – ($Fee * $AmountWantToTrade * $Buy);
$Price = $Buy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Sell – ($Fee * $AmountWantToTrade * $Sell);
$Price = $Sell;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “Exmo”, $Price));

#Code https://www.quadrigacx.com/
#API DOC: https://www.quadrigacx.com/api_info

$Fee = 0.005;
if ($Currency == “CAD”)
{

$jsonAPI = file_get_contents(‘https://api.quadrigacx.com/v2/ticker?book=btc_cad’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘ask’];
$Sell = $retValAPI [‘bid’];

}
elseif ($Currency == “USD”)
{

$jsonAPI = file_get_contents(‘https://api.quadrigacx.com/v2/ticker?book=btc_usd’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘ask’];
$Sell = $retValAPI [‘bid’];

}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at quadrigacx.com!”;
};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy – ($Fee * $AmountWantToTrade * $Buy);
$Price = $Buy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Sell – ($Fee * $AmountWantToTrade * $Sell);
$Price = $Sell;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “quadrigacx.com”, $Price));

#Code #therocktrading.com
#API DOC: https://api.therocktrading.com/doc/v1/index.html#api-Market_API-Tickers

$Fee = 0.005;
if ($Currency == “EUR”)
{

$jsonAPI = file_get_contents(‘https://api.therocktrading.com/v1/funds/tickers’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘tickers’][0][‘ask’];
$Sell= $retValAPI [‘tickers’][0][‘bid’];

}
elseif ($Currency == “USD”)
{

$jsonAPI = file_get_contents(‘https://api.therocktrading.com/v1/funds/tickers’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘tickers’][1][‘ask’];
$Sell= $retValAPI [‘tickers’][1][‘bid’];

}

elseif ($Currency == “XRP”)
{

$jsonAPI = file_get_contents(‘https://api.therocktrading.com/v1/funds/tickers’);
$retValAPI = json_decode($jsonAPI, TRUE);
$Buy = $retValAPI [‘tickers’][2][‘ask’];
$Sell= $retValAPI [‘tickers’][2][‘bid’];

}

else
{
$Buy = 0;
$Sell =0;
echo “Currency is not supported at therocktrading.com!”;
};

#Calculation is: Amount (someone wants to exchange) in a given Currency (BTC, USD, EUR)

if ($Desire == “BUY”)
#Buy Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Buy – ($Fee * $AmountWantToTrade * $Buy);
$Price = $Buy;
}
else
#Sell Bitcoin for USD or EUR
{
$YouWillNeedToPayOrReceive = $AmountWantToTrade * $Sell – ($Fee * $AmountWantToTrade * $Sell);
$Price = $Sell;
};

#Start Filling Array
array_push($DATA, array($YouWillNeedToPayOrReceive ,”$Currency”, “$Desire”, “therocktrading.com”, $Price));

#To add:

#https://api.coincorner.com/api/Ticker?Coin=BTC&Currency=EUR
#https://www.bitquick.co/apiticker1.php
#https://www.alfacashier.com/export-rates (XML)
#https://coinomat.com/ (too old?)
#http://docs.bitpagos.net/en/ (asked for price api)
#https://coinmotion.com/api (comming soon)
#https://www.bitcoin.de/de/affiliate und https://www.bitcoin.de/de/api/marketplace (api 2x pro 60 sec)
#hitbtc.com (didnt know how to use api, sent email)
#https://cryptonit.net/ (https://cryptonit.net/documentation/public-api no idea how to add xml)

#Sort DATA Array to find best price and print it:
array_multisort($DATA);

echo ““.”Best Exchange ” .” to “.$DATA[0][1] .” ” .$AmountWantToTrade .”BTC is ” .$DATA[0][2] .”. Total amount of ” .$DATA[0][3] .” ” .$DATA[0][0] .” . With price: “.$DATA[0][4] .”BTC/”.$Currency.”“.”
“;
echo “Second Best Exchange: “.$DATA[1][2] .” to “.$DATA[1][1].” with price: “.$DATA[1][4] .$DATA[1][0].”. You will receive “.$DATA[1][3].” BTC”.”
“;
echo “Thrird Best Exchange: “.$DATA[2][2] .” to “.$DATA[2][1].” with price: “.$DATA[2][4] .$DATA[2][0].”. You will receive “.$DATA[2][3].” BTC”.”
“;
#See whole DATA array:
print_r($DATA);

$heute = date(“H:i:s”);
echo $heute.’
‘;
?>

[/insert_php]

100

first textbox