Skip to content

Instantly share code, notes, and snippets.

@openm1ke
Last active October 18, 2021 19:32
Show Gist options
  • Select an option

  • Save openm1ke/fdbc61d41c5e1cae5420a33b7011b392 to your computer and use it in GitHub Desktop.

Select an option

Save openm1ke/fdbc61d41c5e1cae5420a33b7011b392 to your computer and use it in GitHub Desktop.
WhatToMine profitable checking script
<?php
//include 'hive_api_class.php';
$al2_hr=570; // hashrate autolykos2 570mh
$al2_p=510;
$eth_hr=151;
$eth_p=380;
$cost=0.12;
$usd_price = json_decode(file_get_contents("https://www.cbr-xml-daily.ru/daily_json.js"), true)['Valute']['USD']['Value'];
$btc_price = json_decode(file_get_contents("https://api.coindesk.com/v1/bpi/currentprice.json"), true)['bpi']['USD']['rate_float'];
$whattomine_path = "https://whattomine.com/coins.json?eth=true&factor[eth_hr]=$eth_hr&factor[eth_p]=$eth_p&al=true&factor[al_hr]=$al2_hr&factor[al_p]=$al2_p&factor[cost]=$cost&sort=Profitability24&volume=0&revenue=24h&dataset=Main&commit=Calculate";
$json_wtm = json_decode(file_get_contents($whattomine_path), true);
$al2_btc = $json_wtm['coins']['Nicehash-Autolykos']['btc_revenue24'];
$eth_btc = $json_wtm['coins']['Nicehash-Ethash']['btc_revenue24'];
$al2_usd = $al2_btc*$btc_price;
$al2_rub = $al2_usd*$usd_price;
$al2_cost = $al2_p*$cost*0.024;
$al2_cost_rub = $al2_cost*$usd_price;
$al2_prof = $al2_usd - $al2_cost;
$al2_prof_rub = $al2_prof*$usd_price;
$eth_usd = $eth_btc*$btc_price;
$eth_rub = $eth_usd*$usd_price;
$eth_cost = $eth_p*$cost*0.024;
$eth_cost_rub = $eth_cost*$usd_price;
$eth_prof = $eth_usd - $eth_cost;
$eth_prof_rub = $eth_prof*$usd_price;
$ae_prof = $al2_prof-$eth_prof;
$ea_prof = $eth_prof-$al2_prof;
$ae_prof_rub = $ae_prof*$usd_price;
$ea_prof_rub = $ea_prof*$usd_price;
$str = "ALykos = $al2_btc ₿ (\$".round($al2_usd,2)."/".round($al2_rub,2)."₽) cost \$".round($al2_cost,2)." (".round($al2_cost_rub,2)."₽), profit \$".round($al2_prof,2)." (".round($al2_prof_rub,2)."₽)
Ethash = $eth_btc ₿ (\$".round($eth_usd,2)."/".round($eth_rub,2)."₽) cost \$".round($eth_cost,2)." (".round($eth_cost_rub,2)."₽), profit \$".round($eth_prof,2)." (".round($eth_prof_rub,2)."₽)\r\n";
echo $str;
if($al2_prof > $eth_prof) echo "Autolykos profitable then ethash by \$".round($ae_prof,2)." (".round($ae_prof_rub,2)."₽)";
else echo "Ethash profitable then autolykos by \$".round($ea_prof,2)." (".round($ea_prof_rub,2)."₽)";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment