mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
banx: rename to cryptomic (part 2)
This commit is contained in:
parent
a5450584e0
commit
294da52732
6 changed files with 31 additions and 27 deletions
|
@ -53,7 +53,7 @@ class CoindbCommand extends CConsoleCommand
|
|||
$nbUpdated += $this->grabCcexIcons();
|
||||
$nbUpdated += $this->grabCryptopiaIcons();
|
||||
$nbUpdated += $this->grabAlcurexIcons();
|
||||
$nbUpdated += $this->grabBanxIcons();
|
||||
$nbUpdated += $this->grabCryptomicIcons();
|
||||
|
||||
echo "total updated: $nbUpdated\n";
|
||||
return 0;
|
||||
|
@ -401,18 +401,18 @@ class CoindbCommand extends CConsoleCommand
|
|||
}
|
||||
|
||||
/**
|
||||
* Icon grabber - Banx
|
||||
* Icon grabber - Cryptomic (Banx.io)
|
||||
*/
|
||||
public function grabBanxIcons()
|
||||
public function grabCryptomicIcons()
|
||||
{
|
||||
$url = 'https://cdn.banx.io/images/currencyicons/';
|
||||
$url = 'https://cdn.cryptomic.com/images/currencyicons/';
|
||||
$nbUpdated = 0;
|
||||
$sql = "SELECT DISTINCT coins.id FROM coins INNER JOIN markets M ON M.coinid = coins.id ".
|
||||
"WHERE M.name='banx' AND IFNULL(coins.image,'') = ''";
|
||||
$coins = dbolist($sql);
|
||||
if (empty($coins))
|
||||
return 0;
|
||||
echo "banx: try to download new icons...\n";
|
||||
echo "cryptomic: try to download new icons...\n";
|
||||
foreach ($coins as $coin) {
|
||||
$coin = getdbo('db_coins', $coin["id"]);
|
||||
$symbol = $coin->symbol;
|
||||
|
@ -432,7 +432,7 @@ class CoindbCommand extends CConsoleCommand
|
|||
}
|
||||
}
|
||||
if ($nbUpdated)
|
||||
echo "$nbUpdated icons downloaded from banx\n";
|
||||
echo "$nbUpdated icons downloaded from cryptomic\n";
|
||||
return $nbUpdated;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,8 +107,8 @@ class ExchangeCommand extends CConsoleCommand
|
|||
if (!empty(EXCH_BANX_USERNAME)) {
|
||||
//$balance = banx_api_user('account/getbalance','?currency=BTC');
|
||||
$balance = banx_api_user('account/getbalances');
|
||||
if (!is_object($balance)) echo "banx error ".json_encode($balance)."\n";
|
||||
else echo("banx all: ".json_encode($balance->result)."\n");
|
||||
if (!is_object($balance)) echo "cryptomic error ".json_encode($balance)."\n";
|
||||
else echo("cryptomic all: ".json_encode($balance->result)."\n");
|
||||
}
|
||||
|
||||
// only one secret key
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
// https://www.banx.io/SimpleAPI?a=marketsv2
|
||||
// https://www.cryptomic.com/SimpleAPI?a=marketsv2
|
||||
|
||||
function banx_simple_api_query($method, $params='')
|
||||
{
|
||||
|
@ -17,11 +17,11 @@ function banx_simple_api_query($method, $params='')
|
|||
return $obj;
|
||||
}
|
||||
|
||||
// https://www.banx.io/api/v2/public/getmarkets
|
||||
// https://www.cryptomic.com/api/v4/public/getticker?market=LTC-BTC
|
||||
|
||||
function banx_public_api_query($method, $params='')
|
||||
{
|
||||
$uri = "https://www.cryptomic.com/api/v2/public/$method";
|
||||
$uri = "https://www.cryptomic.com/api/v4/public/$method";
|
||||
if (!empty($params))
|
||||
$uri .= "$params";
|
||||
|
||||
|
@ -44,7 +44,7 @@ function banx_api_user($method, $params='')
|
|||
|
||||
if (empty(EXCH_BANX_USERNAME) || empty(EXCH_BANX_SECKEY)) return false;
|
||||
|
||||
$uri = "https://www.banx.io/api/v3/$method$params";
|
||||
$uri = "https://www.cryptomic.com/api/v4/$method$params";
|
||||
|
||||
//$nonce = time();
|
||||
$mt = explode(' ', microtime());
|
|
@ -23,7 +23,7 @@ require_once("empoex.php");
|
|||
require_once("jubi.php");
|
||||
require_once("alcurex.php");
|
||||
require_once("cryptopia.php");
|
||||
require_once("banxio.php");
|
||||
require_once("cryptomic.php");
|
||||
|
||||
/* Format an exchange coin Url */
|
||||
function getMarketUrl($coin, $marketName)
|
||||
|
@ -54,7 +54,7 @@ function getMarketUrl($coin, $marketName)
|
|||
else if($marketName == 'bter')
|
||||
$url = "https://bter.com/trade/{$lowsymbol}_btc";
|
||||
else if($marketName == 'banx')
|
||||
$url = "https://www.banx.io/trade?c={$symbol}&p=BTC";
|
||||
$url = "https://www.cryptomic.com/trade?c={$symbol}&p=BTC";
|
||||
else if($marketName == 'bitex')
|
||||
$url = "https://bitex.club/markets/{$lowsymbol}btc";
|
||||
else if($marketName == 'empoex')
|
||||
|
|
|
@ -3,24 +3,30 @@
|
|||
function doBanxTrading($quick=false)
|
||||
{
|
||||
$exchange = 'banx';
|
||||
$updatebalances = !YAAMP_ALLOW_EXCHANGE;
|
||||
|
||||
// [{"currency":"BTC","balance":0.02265703,"available":0.02265703,"pending":0,"isbts":0,"cryptoaddress":"1DCVPWgs..."}]}
|
||||
$balances = banx_api_user('account/getbalances');
|
||||
if(!$balances || !isset($balances->result) || !$balances->success) return;
|
||||
|
||||
$savebalance = getdbosql('db_balances', "name='{$exchange}'");
|
||||
if (is_object($savebalance)) {
|
||||
$savebalance->balance = 0;
|
||||
$savebalance->save();
|
||||
|
||||
dborun("UPDATE markets SET balance=0 WHERE name='{$exchange}'");
|
||||
}
|
||||
|
||||
foreach($balances->result as $balance)
|
||||
{
|
||||
if ($balance->currency == 'BTC') {
|
||||
|
||||
$savebalance = getdbosql('db_balances', "name='{$exchange}'");
|
||||
if (!is_object($savebalance)) continue;
|
||||
|
||||
$savebalance->balance = $balance->available;
|
||||
$savebalance->save();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!YAAMP_ALLOW_EXCHANGE) {
|
||||
if ($updatebalances) {
|
||||
// store available balance in market table
|
||||
$coins = getdbolist('db_coins', "symbol=:symbol OR symbol2=:symbol",
|
||||
array(':symbol'=>$balance->currency)
|
||||
|
@ -29,14 +35,12 @@ function doBanxTrading($quick=false)
|
|||
foreach ($coins as $coin) {
|
||||
$market = getdbosql('db_markets', "coinid=:coinid AND name='{$exchange}'", array(':coinid'=>$coin->id));
|
||||
if (!$market) continue;
|
||||
if ($market->balance != $balance->available) {
|
||||
$market->balance = $balance->available;
|
||||
if (!empty($balance->cryptoaddress) && $market->deposit_address != $balance->cryptoaddress) {
|
||||
debuglog("{$exchange}: {$coin->symbol} deposit address updated");
|
||||
$market->deposit_address = $balance->cryptoaddress;
|
||||
}
|
||||
$market->save();
|
||||
$market->balance = $balance->available;
|
||||
if (!empty($balance->cryptoaddress) && $market->deposit_address != $balance->cryptoaddress) {
|
||||
debuglog("{$exchange}: {$coin->symbol} deposit address updated");
|
||||
$market->deposit_address = $balance->cryptoaddress;
|
||||
}
|
||||
$market->save();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ require_once('c-cex_trading.php');
|
|||
require_once('kraken_trading.php');
|
||||
require_once('yobit_trading.php');
|
||||
require_once('alcurex_trading.php');
|
||||
require_once('banx_trading.php');
|
||||
require_once('cryptomic_trading.php');
|
||||
require_once('cryptopia_trading.php');
|
||||
require_once('safecex_trading.php');
|
||||
|
||||
|
@ -109,4 +109,4 @@ function runExchange($exchangeName=false) {
|
|||
updatePoloniexMarkets();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue