mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-06 10:39:45 +00:00
markets: add cryptonator api call for installed coins without price
This commit is contained in:
parent
dd180e3105
commit
37a8402c12
2 changed files with 32 additions and 2 deletions
|
@ -18,6 +18,8 @@ function BackendPricesUpdate()
|
|||
updateJubiMarkets();
|
||||
updateBanxioMarkets();
|
||||
|
||||
updateOtherMarkets();
|
||||
|
||||
$list2 = getdbolist('db_coins', "installed and symbol2 is not null");
|
||||
foreach($list2 as $coin2)
|
||||
{
|
||||
|
@ -775,3 +777,29 @@ function updateEmpoexMarkets()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update other installed coins price from cryptonator
|
||||
function updateOtherMarkets()
|
||||
{
|
||||
$coins = getdbolist('db_coins', "installed AND IFNULL(price,0.0) = 0.0");
|
||||
foreach($coins as $coin)
|
||||
{
|
||||
$symbol = $coin->symbol;
|
||||
if (!empty($coin->symbol2)) $symbol = $coin->symbol2;
|
||||
|
||||
$json = file_get_contents("https://www.cryptonator.com/api/full/".strtolower($symbol)."-btc");
|
||||
$object = json_decode($json);
|
||||
if (empty($object)) continue;
|
||||
|
||||
if (is_object($object) && isset($object->ticker)) {
|
||||
$ticker = $object->ticker;
|
||||
if ($ticker->target == 'BTC' && $ticker->volume > 1) {
|
||||
$coin->price2 = $ticker->price;
|
||||
$coin->price = AverageIncrement((float)$coin->price, (float)$coin->price2);
|
||||
if ($coin->save()) {
|
||||
debuglog("update price of $symbol ".bitcoinvaluetoa($coin->price));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ echo "<a href='http://google.com/search?q=$coin->name%20$coin->symbol%20bitcoint
|
|||
|
||||
echo "<br><div id='main_results'></div>";
|
||||
|
||||
/*
|
||||
echo "<br><a href='/site/makeconfigfile?id=$coin->id'><b>MAKE CONFIG & START</b></a>";
|
||||
|
||||
if($info)
|
||||
|
@ -47,8 +48,8 @@ if($info)
|
|||
echo "<br><a href='/site/restartcoin?id=$coin->id'><b>RESTART COIND</b></a>";
|
||||
echo "<br><a href='/site/stopcoin?id=$coin->id'><b>STOP COIND</b></a>";
|
||||
|
||||
// if(isset($info['balance']) && $info['balance'] && !empty($coin->deposit_address))
|
||||
// echo "<br><a href='javascript:showSellAmountDialog()'><b>SEND BALANCE TO</b></a> - $coin->deposit_address";
|
||||
if(isset($info['balance']) && $info['balance'] && !empty($coin->deposit_address))
|
||||
echo "<br><a href='javascript:showSellAmountDialog()'><b>SEND BALANCE TO</b></a> - $coin->deposit_address";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -59,6 +60,7 @@ else
|
|||
echo "<br><a href='javascript:uninstall_coin();'><b>UNINSTALL COIN</b></a><br>";
|
||||
}
|
||||
|
||||
*/
|
||||
echo "<br><a href='/site/clearearnings?id=$coin->id'><b>CLEAR EARNINGS</b></a>";
|
||||
echo "<br><a href='/site/deleteearnings?id=$coin->id'><b>DELETE EARNINGS</b></a>";
|
||||
echo "<br><a href='/site/payuserscoin?id=$coin->id'><b>DO PAYMENTS</b></a>";
|
||||
|
|
Loading…
Add table
Reference in a new issue