mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-21 02:19:47 +00:00
markets: cryptopia maintenance + livecoin deposit addr
This commit is contained in:
parent
448144949a
commit
8d930e0f33
3 changed files with 33 additions and 3 deletions
|
@ -156,7 +156,8 @@ class ExchangeCommand extends CConsoleCommand
|
||||||
}
|
}
|
||||||
if (!empty(EXCH_CRYPTOPIA_KEY)) {
|
if (!empty(EXCH_CRYPTOPIA_KEY)) {
|
||||||
$balance = cryptopia_api_user('GetBalance',array("Currency"=>"BTC"));
|
$balance = cryptopia_api_user('GetBalance',array("Currency"=>"BTC"));
|
||||||
echo("cryptopia btc: ".json_encode($balance->Data)."\n");
|
if (!is_object($balance)) echo("cryptopia error ".json_encode($balance)."\n");
|
||||||
|
else echo("cryptopia btc: ".json_encode($balance->Data)."\n");
|
||||||
}
|
}
|
||||||
if (!empty(EXCH_KRAKEN_KEY)) {
|
if (!empty(EXCH_KRAKEN_KEY)) {
|
||||||
$balance = kraken_api_user('Balance');
|
$balance = kraken_api_user('Balance');
|
||||||
|
|
|
@ -775,6 +775,10 @@ function updateCryptopiaMarkets()
|
||||||
$market->message = 'disabled from settings';
|
$market->message = 'disabled from settings';
|
||||||
$market->save();
|
$market->save();
|
||||||
continue;
|
continue;
|
||||||
|
} else if ($market->message == 'disabled from settings') {
|
||||||
|
$market->disabled = 0;
|
||||||
|
$market->message = '';
|
||||||
|
$market->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($data->Data as $ticker) {
|
foreach ($data->Data as $ticker) {
|
||||||
|
@ -1021,9 +1025,34 @@ function updateLivecoinMarkets()
|
||||||
if (empty($coin->price2)) {
|
if (empty($coin->price2)) {
|
||||||
$coin->price = $market->price;
|
$coin->price = $market->price;
|
||||||
$coin->price2 = $market->price2;
|
$coin->price2 = $market->price2;
|
||||||
$coin->market = 'empoex';
|
//$coin->market = 'shapeshift';
|
||||||
$coin->save();
|
$coin->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!empty(EXCH_LIVECOIN_KEY) && $market->disabled == 0)
|
||||||
|
{
|
||||||
|
$last_checked = cache()->get($exchange.'-deposit_address-check-'.$coin->symbol);
|
||||||
|
if(empty($market->deposit_address) && !$last_checked)
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
$data = livecoin_api_user('payment/get/address', array('currency'=>$coin->symbol));
|
||||||
|
if(!empty($data) && objSafeVal($data, 'wallet', '') != '') {
|
||||||
|
$addr = arraySafeVal($data, 'wallet');
|
||||||
|
if (!empty($addr) && $addr != $market->deposit_address) {
|
||||||
|
if (strpos($addr, 'Error') !== false)
|
||||||
|
$market->message = $addr;
|
||||||
|
else {
|
||||||
|
$market->deposit_address = $addr;
|
||||||
|
// delimiter "::" for memo / payment id
|
||||||
|
$market->message = null;
|
||||||
|
debuglog("$exchange: deposit address for {$coin->symbol} updated");
|
||||||
|
}
|
||||||
|
$market->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cache()->set($exchange.'-deposit_address-check-'.$coin->symbol, time(), 24*3600);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ function cryptopia_api_user($method, $params=NULL)
|
||||||
$result = json_decode($res);
|
$result = json_decode($res);
|
||||||
if(!is_object($result) && !is_array($result)) {
|
if(!is_object($result) && !is_array($result)) {
|
||||||
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
debuglog("cryptopia: $method failed ($status) $res");
|
debuglog("cryptopia: $method failed ($status) ".strip_data($res));
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
Loading…
Add table
Reference in a new issue