mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 09:27: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
|
||||
require_once('poloniex_trading.php');
|
||||
require_once('binance_trading.php');
|
||||
require_once('bittrex_trading.php');
|
||||
require_once('bleutrade_trading.php');
|
||||
require_once('bter_trading.php');
|
||||
|
@ -23,6 +24,9 @@ function cancelExchangeOrder($order=false)
|
|||
case 'yobit':
|
||||
doYobitCancelOrder($order->uuid);
|
||||
break;
|
||||
case 'binance':
|
||||
doBinanceCancelOrder($order->uuid);
|
||||
break;
|
||||
case 'c-cex':
|
||||
doCCexCancelOrder($order->uuid);
|
||||
break;
|
||||
|
@ -59,6 +63,11 @@ function runExchange($exchangeName=false)
|
|||
updateAlcurexMarkets();
|
||||
break;
|
||||
|
||||
case 'binance':
|
||||
doBinanceTrading(true);
|
||||
updateBinanceMarkets();
|
||||
break;
|
||||
|
||||
case 'bter':
|
||||
doBterTrading(true);
|
||||
updateBterMarkets();
|
||||
|
|
|
@ -143,12 +143,13 @@ class CronjobController extends CommonController
|
|||
case 2:
|
||||
if(!YAAMP_PRODUCTION) break;
|
||||
|
||||
doYobitTrading();
|
||||
doBinanceTrading();
|
||||
doCCexTrading();
|
||||
doBterTrading();
|
||||
doBleutradeTrading();
|
||||
doKuCoinTrading();
|
||||
doNovaTrading();
|
||||
doYobitTrading();
|
||||
doCoinsMarketsTrading();
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue