mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
api: kucoin 2.0 fixes, reenable it
also fix the new market and coindb icons urls
This commit is contained in:
parent
a5de1e3d1a
commit
2cbdf535e2
6 changed files with 12 additions and 12 deletions
|
@ -494,7 +494,7 @@ class CoindbCommand extends CConsoleCommand
|
||||||
*/
|
*/
|
||||||
public function grabKuCoinIcons()
|
public function grabKuCoinIcons()
|
||||||
{
|
{
|
||||||
$url = 'https://assets.kucoin.com/www/1.2.0/assets/coins/';//QLC.png
|
$url = 'https://assets.kucoin.com/www/coin/pc/';//GRIN.png
|
||||||
$nbUpdated = 0;
|
$nbUpdated = 0;
|
||||||
$sql = "SELECT DISTINCT coins.id FROM coins INNER JOIN markets M ON M.coinid = coins.id ".
|
$sql = "SELECT DISTINCT coins.id FROM coins INNER JOIN markets M ON M.coinid = coins.id ".
|
||||||
"WHERE M.name='kucoin' AND IFNULL(coins.image,'') = ''";
|
"WHERE M.name='kucoin' AND IFNULL(coins.image,'') = ''";
|
||||||
|
|
|
@ -1485,8 +1485,11 @@ function updateKuCoinMarkets()
|
||||||
$symbols = kucoin_api_query('symbols','market=BTC');
|
$symbols = kucoin_api_query('symbols','market=BTC');
|
||||||
if(!kucoin_result_valid($symbols) || empty($symbols->data)) return;
|
if(!kucoin_result_valid($symbols) || empty($symbols->data)) return;
|
||||||
|
|
||||||
//$markets = kucoin_api_query('markets/allTickers'); // useless daily stats
|
usleep(500);
|
||||||
//if(!kucoin_result_valid($markets) || empty($markets->data)) return;
|
$markets = kucoin_api_query('market/allTickers');
|
||||||
|
if(!kucoin_result_valid($markets) || empty($markets->data)) return;
|
||||||
|
if(!isset($markets->data->ticker) || !is_array($markets->data->ticker)) return;
|
||||||
|
$tickers = $markets->data->ticker;
|
||||||
|
|
||||||
foreach($list as $market)
|
foreach($list as $market)
|
||||||
{
|
{
|
||||||
|
@ -1515,14 +1518,13 @@ function updateKuCoinMarkets()
|
||||||
$market->save();
|
$market->save();
|
||||||
if ($market->disabled) continue;
|
if ($market->disabled) continue;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
foreach ($markets->data as $ticker) {
|
foreach ($tickers as $ticker) {
|
||||||
if ($ticker->symbol != $pair) continue;
|
if ($ticker->symbol != $pair) continue;
|
||||||
if (objSafeVal($ticker,'buy',-1) == -1) continue;
|
if (objSafeVal($ticker,'buy',-1) == -1) continue;
|
||||||
|
|
||||||
$market->price = AverageIncrement($market->price, $ticker->buy);
|
$market->price = AverageIncrement($market->price, $ticker->buy);
|
||||||
$market->price2 = AverageIncrement($market->price2, objSafeVal($ticker,'sell',$ticker->buy));
|
$market->price2 = AverageIncrement($market->price2, objSafeVal($ticker,'sell',$ticker->buy));
|
||||||
$market->txfee = $ticker->feeRate * 100; // is 0.1% for trades (0.001)
|
|
||||||
$market->priority = -1;
|
$market->priority = -1;
|
||||||
$market->pricetime = time();
|
$market->pricetime = time();
|
||||||
|
|
||||||
|
@ -1535,7 +1537,6 @@ function updateKuCoinMarkets()
|
||||||
$coin->save();
|
$coin->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ function updateRawcoins()
|
||||||
exchange_set_default('escodex', 'disabled', true);
|
exchange_set_default('escodex', 'disabled', true);
|
||||||
exchange_set_default('gateio', 'disabled', true);
|
exchange_set_default('gateio', 'disabled', true);
|
||||||
exchange_set_default('jubi', 'disabled', true);
|
exchange_set_default('jubi', 'disabled', true);
|
||||||
exchange_set_default('kucoin', 'disabled', true);
|
|
||||||
exchange_set_default('nova', 'disabled', true);
|
exchange_set_default('nova', 'disabled', true);
|
||||||
exchange_set_default('stocksexchange', 'disabled', true);
|
exchange_set_default('stocksexchange', 'disabled', true);
|
||||||
exchange_set_default('tradesatoshi', 'disabled', true);
|
exchange_set_default('tradesatoshi', 'disabled', true);
|
||||||
|
@ -340,7 +339,7 @@ function updateRawcoins()
|
||||||
|
|
||||||
if (!exchange_get('kucoin', 'disabled')) {
|
if (!exchange_get('kucoin', 'disabled')) {
|
||||||
$list = kucoin_api_query('currencies');
|
$list = kucoin_api_query('currencies');
|
||||||
if(is_object($list) && isset($list->data) && !empty($list->data))
|
if(kucoin_result_valid($list) && !empty($list->data))
|
||||||
{
|
{
|
||||||
dborun("UPDATE markets SET deleted=true WHERE name='kucoin'");
|
dborun("UPDATE markets SET deleted=true WHERE name='kucoin'");
|
||||||
foreach($list->data as $item) {
|
foreach($list->data as $item) {
|
||||||
|
|
|
@ -121,7 +121,7 @@ function getMarketUrl($coin, $marketName)
|
||||||
else if($market == 'hitbtc')
|
else if($market == 'hitbtc')
|
||||||
$url = "https://hitbtc.com/exchange/{$symbol}-to-{$base}";
|
$url = "https://hitbtc.com/exchange/{$symbol}-to-{$base}";
|
||||||
else if($market == 'kucoin')
|
else if($market == 'kucoin')
|
||||||
$url = "https://www.kucoin.com/#/trade.pro/{$symbol}-{$base}";
|
$url = "https://www.kucoin.com/trade/{$symbol}-{$base}";
|
||||||
else if($market == 'livecoin')
|
else if($market == 'livecoin')
|
||||||
$url = "https://www.livecoin.net/trade/?currencyPair={$symbol}%2F{$base}";
|
$url = "https://www.livecoin.net/trade/?currencyPair={$symbol}%2F{$base}";
|
||||||
else if($market == 'nova')
|
else if($market == 'nova')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// see https://kucoinapidocs.docs.apiary.io/
|
// see https://docs.kucoin.com/
|
||||||
|
|
||||||
function kucoin_result_valid($obj, $method='')
|
function kucoin_result_valid($obj, $method='')
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,7 @@ function doKuCoinTrading($quick=false)
|
||||||
$checked_today = cache()->get($exchange.'-deposit_address-check-'.$coin->symbol);
|
$checked_today = cache()->get($exchange.'-deposit_address-check-'.$coin->symbol);
|
||||||
if ($coin->installed && !$checked_today) {
|
if ($coin->installed && !$checked_today) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$obj = kucoin_api_user('deposit-addresses','currency='.$coin->symbol);
|
$obj = kucoin_api_user('deposit-addresses',array('currency'=>$coin->symbol));
|
||||||
if (!kucoin_result_valid($obj)) continue;
|
if (!kucoin_result_valid($obj)) continue;
|
||||||
$result = $obj->data;
|
$result = $obj->data;
|
||||||
$deposit_address = objSafeVal($result,'address');
|
$deposit_address = objSafeVal($result,'address');
|
||||||
|
|
Loading…
Add table
Reference in a new issue