mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-21 02:19:47 +00:00
import raw coins list with allcoin api too
This commit is contained in:
parent
b1581bdec5
commit
d0ba82e2c0
5 changed files with 77 additions and 2 deletions
|
@ -10,6 +10,7 @@ function BackendPricesUpdate()
|
|||
updateBleutradeMarkets();
|
||||
updatePoloniexMarkets();
|
||||
updateYobitMarkets();
|
||||
updateAllcoinMarkets();
|
||||
updateJubiMarkets();
|
||||
updateAlcurexMarkets();
|
||||
updateCryptopiaMarkets();
|
||||
|
@ -646,8 +647,8 @@ function updateBanxioMarkets()
|
|||
$coin->price2 = $market->price2;
|
||||
$coin->save();
|
||||
}
|
||||
if ($coin->name == 'unknown' && !empty($market->currencylong)) {
|
||||
$coin->name = $market->currencylong;
|
||||
if ($coin->name == 'unknown' && !empty($ticker->currencylong)) {
|
||||
$coin->name = $ticker->currencylong;
|
||||
$coin->save();
|
||||
debuglog("banx: update $symbol name {$coin->name}");
|
||||
}
|
||||
|
@ -656,3 +657,37 @@ function updateBanxioMarkets()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateAllcoinMarkets()
|
||||
{
|
||||
$data = allcoin_api_query('pairs');
|
||||
if(!is_object($data)) return;
|
||||
|
||||
$list = getdbolist('db_markets', "name='allcoin'");
|
||||
foreach($list as $market)
|
||||
{
|
||||
$coin = getdbo('db_coins', $market->coinid);
|
||||
if(!$coin || !$coin->installed) continue;
|
||||
|
||||
$pair = strtoupper($coin->symbol).'_BTC';
|
||||
|
||||
if (isset($data->data[$pair])) {
|
||||
$ticker = $data->data[$pair];
|
||||
$market->price = AverageIncrement($market->price, $ticker->top_bid);
|
||||
$market->price2 = AverageIncrement($market->price2, $ticker->top_ask);
|
||||
|
||||
if (floatval($ticker->volume_24h_BTC) > 0.01)
|
||||
$market->save();
|
||||
if (empty($coin->price2)) {
|
||||
$coin->price = $market->price;
|
||||
$coin->price2 = $market->price2;
|
||||
$coin->save();
|
||||
}
|
||||
if ($coin->name == 'unknown' && !empty($ticker->name)) {
|
||||
$coin->name = $ticker->name;
|
||||
$coin->save();
|
||||
debuglog("allcoin: update $symbol name {$coin->name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,19 @@ function updateRawcoins()
|
|||
}
|
||||
}
|
||||
|
||||
$list = allcoin_api_query('pairs');
|
||||
if(isset($list->data))
|
||||
{
|
||||
dborun("UPDATE markets SET deleted=true WHERE name='allcoin'");
|
||||
foreach($list->data as $pair => $item) {
|
||||
if (strtoupper($item->exchange) !== 'BTC')
|
||||
continue;
|
||||
if (intval($item->status) == -2)
|
||||
continue;
|
||||
updateRawCoin('allcoin', $item->type, $item->name);
|
||||
}
|
||||
}
|
||||
|
||||
$list = cryptopia_api_query('GetMarkets');
|
||||
if(isset($list->Data))
|
||||
{
|
||||
|
|
17
web/yaamp/core/exchange/allcoin.php
Normal file
17
web/yaamp/core/exchange/allcoin.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
// https://www.allcoin.com/pub/api#market_summary
|
||||
// https://www.allcoin.com/api2/pairs
|
||||
|
||||
function allcoin_api_query($method, $params='')
|
||||
{
|
||||
$uri = "https://www.allcoin.com/api2/{$method}{$params}";
|
||||
|
||||
$ch = curl_init($uri);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$execResult = strip_tags(curl_exec($ch));
|
||||
$obj = json_decode($execResult);
|
||||
|
||||
return $obj;
|
||||
}
|
|
@ -6,6 +6,7 @@ require_once("bittrex.php");
|
|||
require_once("ccexapi.php");
|
||||
require_once("bleutrade.php");
|
||||
require_once("yobit.php");
|
||||
require_once("allcoin.php");
|
||||
require_once("jubi.php");
|
||||
require_once("alcurex.php");
|
||||
require_once("cryptopia.php");
|
||||
|
|
|
@ -110,6 +110,15 @@ foreach($coins as $coin)
|
|||
else if($market->name == 'alcurex')
|
||||
$url = "https://alcurex.org/index.php/crypto/market?pair={$lowsymbol}_btc";
|
||||
|
||||
else if($market->name == 'allcoin')
|
||||
$url = "https://www.allcoin.com/trade/{$coin->symbol}_BTC";
|
||||
|
||||
else if($market->name == 'banx')
|
||||
$url = "https://www.banx.io/trade?c={$coin->symbol}&p=BTC";
|
||||
|
||||
else if($market->name == 'bitex')
|
||||
$url = "https://bitex.club/markets/{$lowsymbol}btc";
|
||||
|
||||
echo "<a href='$url' target=_blank>$market->name</a> ";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue