poloniex: check deposit address before generating one

This commit is contained in:
Tanguy Pruvot 2017-08-05 23:57:16 +02:00
parent fd77e477b0
commit 196507fe04
2 changed files with 8 additions and 2 deletions

View file

@ -556,8 +556,14 @@ function updatePoloniexMarkets()
$market->save(); $market->save();
if(empty($market->deposit_address) && $coin->installed && !empty(EXCH_POLONIEX_KEY)) { if(empty($market->deposit_address) && $coin->installed && !empty(EXCH_POLONIEX_KEY)) {
if ($coin->symbol != 'EXE') $last_checked = cache()->get($exchange.'-deposit_address-check');
if (time() - $last_checked < 3600) {
// if still empty after get_deposit_addresses(), generate one
$poloniex->generate_address($coin->symbol); $poloniex->generate_address($coin->symbol);
sleep(1);
}
// empty address found, so force get_deposit_addresses check
cache()->set($exchange.'-deposit_address-check', 0, 10);
} }
// debuglog("$exchange: update $coin->symbol: $market->price $market->price2"); // debuglog("$exchange: update $coin->symbol: $market->price $market->price2");
@ -896,6 +902,7 @@ function updateHitBTCMarkets()
$market->price = AverageIncrement($market->price, (double)$ticker['bid']); $market->price = AverageIncrement($market->price, (double)$ticker['bid']);
$market->price2 = AverageIncrement($market->price2, $price2); $market->price2 = AverageIncrement($market->price2, $price2);
$market->pricetime = time(); // $ticker->timestamp $market->pricetime = time(); // $ticker->timestamp
$market->priority = -1;
$market->save(); $market->save();
if (empty($coin->price2) && strpos($pair,'BTC') !== false) { if (empty($coin->price2) && strpos($pair,'BTC') !== false) {

View file

@ -117,7 +117,6 @@ class poloniex
} }
public function generate_address($currency) { public function generate_address($currency) {
debuglog("poloniex: generate address $currency");
return $this->query( return $this->query(
array( array(
'command' => 'generateNewAddress', 'command' => 'generateNewAddress',