mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
binance: update balances
deposit addresses seems missing in their api
This commit is contained in:
parent
e569b57749
commit
b760beaad3
3 changed files with 67 additions and 1 deletions
56
web/yaamp/core/trading/binance_trading.php
Normal file
56
web/yaamp/core/trading/binance_trading.php
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function doBinanceCancelOrder($OrderID=false)
|
||||||
|
{
|
||||||
|
if(!$OrderID) return;
|
||||||
|
|
||||||
|
// todo
|
||||||
|
}
|
||||||
|
|
||||||
|
function doBinanceTrading($quick=false)
|
||||||
|
{
|
||||||
|
$exchange = 'binance';
|
||||||
|
$updatebalances = true;
|
||||||
|
|
||||||
|
if (exchange_get($exchange, 'disabled')) return;
|
||||||
|
|
||||||
|
$data = binance_api_user('account');
|
||||||
|
if(!is_object($data) || empty($data->balances)) return;
|
||||||
|
|
||||||
|
$savebalance = getdbosql('db_balances', "name='$exchange'");
|
||||||
|
|
||||||
|
if (is_array($data->balances))
|
||||||
|
foreach($data->balances as $balance)
|
||||||
|
{
|
||||||
|
if ($balance->asset == 'BTC') {
|
||||||
|
if (is_object($savebalance)) {
|
||||||
|
$savebalance->balance = $balance->free;
|
||||||
|
$savebalance->save();
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($updatebalances) {
|
||||||
|
// store available balance in market table
|
||||||
|
$coins = getdbolist('db_coins', "symbol=:symbol OR symbol2=:symbol",
|
||||||
|
array(':symbol'=>$balance->asset)
|
||||||
|
);
|
||||||
|
if (empty($coins)) continue;
|
||||||
|
foreach ($coins as $coin) {
|
||||||
|
$market = getdbosql('db_markets',
|
||||||
|
"coinid=:coinid AND name='$exchange' ORDER BY balance"
|
||||||
|
, array(':coinid'=>$coin->id)
|
||||||
|
);
|
||||||
|
if (!$market) continue;
|
||||||
|
$market->balance = $balance->free;
|
||||||
|
$market->ontrade = $balance->locked;
|
||||||
|
$market->balancetime = time();
|
||||||
|
$market->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!YAAMP_ALLOW_EXCHANGE) return;
|
||||||
|
|
||||||
|
// real trading, todo..
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('poloniex_trading.php');
|
require_once('poloniex_trading.php');
|
||||||
|
require_once('binance_trading.php');
|
||||||
require_once('bittrex_trading.php');
|
require_once('bittrex_trading.php');
|
||||||
require_once('bleutrade_trading.php');
|
require_once('bleutrade_trading.php');
|
||||||
require_once('bter_trading.php');
|
require_once('bter_trading.php');
|
||||||
|
@ -23,6 +24,9 @@ function cancelExchangeOrder($order=false)
|
||||||
case 'yobit':
|
case 'yobit':
|
||||||
doYobitCancelOrder($order->uuid);
|
doYobitCancelOrder($order->uuid);
|
||||||
break;
|
break;
|
||||||
|
case 'binance':
|
||||||
|
doBinanceCancelOrder($order->uuid);
|
||||||
|
break;
|
||||||
case 'c-cex':
|
case 'c-cex':
|
||||||
doCCexCancelOrder($order->uuid);
|
doCCexCancelOrder($order->uuid);
|
||||||
break;
|
break;
|
||||||
|
@ -59,6 +63,11 @@ function runExchange($exchangeName=false)
|
||||||
updateAlcurexMarkets();
|
updateAlcurexMarkets();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'binance':
|
||||||
|
doBinanceTrading(true);
|
||||||
|
updateBinanceMarkets();
|
||||||
|
break;
|
||||||
|
|
||||||
case 'bter':
|
case 'bter':
|
||||||
doBterTrading(true);
|
doBterTrading(true);
|
||||||
updateBterMarkets();
|
updateBterMarkets();
|
||||||
|
|
|
@ -143,12 +143,13 @@ class CronjobController extends CommonController
|
||||||
case 2:
|
case 2:
|
||||||
if(!YAAMP_PRODUCTION) break;
|
if(!YAAMP_PRODUCTION) break;
|
||||||
|
|
||||||
doYobitTrading();
|
doBinanceTrading();
|
||||||
doCCexTrading();
|
doCCexTrading();
|
||||||
doBterTrading();
|
doBterTrading();
|
||||||
doBleutradeTrading();
|
doBleutradeTrading();
|
||||||
doKuCoinTrading();
|
doKuCoinTrading();
|
||||||
doNovaTrading();
|
doNovaTrading();
|
||||||
|
doYobitTrading();
|
||||||
doCoinsMarketsTrading();
|
doCoinsMarketsTrading();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue