mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
dos2unix all files, we are on linux
trim them, btw... its important to start on a clean base...
This commit is contained in:
parent
a319e02b0b
commit
bb31cec957
291 changed files with 64248 additions and 64249 deletions
|
@ -189,8 +189,8 @@ class CDateFormatter extends CComponent
|
|||
|
||||
/**
|
||||
* Get the year.
|
||||
* "yy" will return the last two digits of year.
|
||||
* "y...y" will pad the year with 0 in the front, e.g. "yyyyy" will generate "02008" for year 2008.
|
||||
* "yy" will return the last two digits of year.
|
||||
* "y...y" will pad the year with 0 in the front, e.g. "yyyyy" will generate "02008" for year 2008.
|
||||
* @param string a pattern.
|
||||
* @param array result of {@link CTimestamp::getdate}.
|
||||
* @return string formatted year
|
||||
|
@ -206,11 +206,11 @@ class CDateFormatter extends CComponent
|
|||
|
||||
/**
|
||||
* Get the month.
|
||||
* "M" will return integer 1 through 12;
|
||||
* "MM" will return two digits month number with necessary zero padding, e.g. 05;
|
||||
* "MMM" will return the abrreviated month name, e.g. "Jan";
|
||||
* "MMMM" will return the full month name, e.g. "January";
|
||||
* "MMMMM" will return the narrow month name, e.g. "J";
|
||||
* "M" will return integer 1 through 12;
|
||||
* "MM" will return two digits month number with necessary zero padding, e.g. 05;
|
||||
* "MMM" will return the abrreviated month name, e.g. "Jan";
|
||||
* "MMMM" will return the full month name, e.g. "January";
|
||||
* "MMMMM" will return the narrow month name, e.g. "J";
|
||||
* @param string a pattern.
|
||||
* @param array result of {@link CTimestamp::getdate}.
|
||||
* @return string month name
|
||||
|
@ -237,7 +237,7 @@ class CDateFormatter extends CComponent
|
|||
|
||||
/**
|
||||
* Get the day of the month.
|
||||
* "d" for non-padding, "dd" will always return 2 digits day numbers, e.g. 05.
|
||||
* "d" for non-padding, "dd" will always return 2 digits day numbers, e.g. 05.
|
||||
* @param string a pattern.
|
||||
* @param array result of {@link CTimestamp::getdate}.
|
||||
* @return string day of the month
|
||||
|
@ -284,9 +284,9 @@ class CDateFormatter extends CComponent
|
|||
|
||||
/**
|
||||
* Get the day of the week.
|
||||
* "E", "EE", "EEE" will return abbreviated week day name, e.g. "Tues";
|
||||
* "EEEE" will return full week day name;
|
||||
* "EEEEE" will return the narrow week day name, e.g. "T";
|
||||
* "E", "EE", "EEE" will return abbreviated week day name, e.g. "Tues";
|
||||
* "EEEE" will return full week day name;
|
||||
* "EEEEE" will return the narrow week day name, e.g. "T";
|
||||
* @param string a pattern.
|
||||
* @param array result of {@link CTimestamp::getdate}.
|
||||
* @return string day of the week.
|
||||
|
|
|
@ -34,7 +34,7 @@ class CFileHelper
|
|||
* Level -1 means copying all directories and files under the directory;
|
||||
* Level 0 means copying only the files DIRECTLY under the directory;
|
||||
* level N means copying those directories that are within N levels.
|
||||
* </li>
|
||||
* </li>
|
||||
* </ul>
|
||||
*/
|
||||
public static function copyDirectory($src,$dst,$options=array())
|
||||
|
@ -60,7 +60,7 @@ class CFileHelper
|
|||
* Level -1 means searching for all directories and files under the directory;
|
||||
* Level 0 means searching for only the files DIRECTLY under the directory;
|
||||
* level N means searching for those directories that are within N levels.
|
||||
* </li>
|
||||
* </li>
|
||||
* </ul>
|
||||
* @return array files found under the directory. The file list is sorted.
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ class CAutoComplete extends CInputWidget
|
|||
* If the URL is an empty string, the currently requested URL is used.
|
||||
* This property will be ignored if {@link data} is set.
|
||||
* @see data
|
||||
*/
|
||||
*/
|
||||
public $url='';
|
||||
/**
|
||||
* @var mixed the CSS file used for the widget. Defaults to null, meaning
|
||||
|
|
|
@ -7,9 +7,9 @@ function BackendClearEarnings()
|
|||
$delay = time() - 150*60;
|
||||
$total_cleared = 0;
|
||||
|
||||
$list = getdbolist('db_earnings', "status=1 and mature_time<$delay");
|
||||
foreach($list as $earning)
|
||||
{
|
||||
$list = getdbolist('db_earnings', "status=1 and mature_time<$delay");
|
||||
foreach($list as $earning)
|
||||
{
|
||||
$user = getdbo('db_accounts', $earning->userid);
|
||||
if(!$user)
|
||||
{
|
||||
|
@ -24,9 +24,9 @@ function BackendClearEarnings()
|
|||
continue;
|
||||
}
|
||||
|
||||
$earning->status = 2; // cleared
|
||||
$earning->price = $coin->price;
|
||||
$earning->save();
|
||||
$earning->status = 2; // cleared
|
||||
$earning->price = $coin->price;
|
||||
$earning->save();
|
||||
|
||||
// $refcoin = getdbo('db_coins', $user->coinid);
|
||||
// if($refcoin && $refcoin->price<=0) continue;
|
||||
|
@ -39,9 +39,9 @@ function BackendClearEarnings()
|
|||
|
||||
if($user->coinid == 6)
|
||||
$total_cleared += $value;
|
||||
}
|
||||
}
|
||||
|
||||
if($total_cleared>0)
|
||||
if($total_cleared>0)
|
||||
debuglog("total cleared from mining $total_cleared BTC");
|
||||
}
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ function BackendCoinsUpdate()
|
|||
$coin->rpcencoding = 'POW';
|
||||
}
|
||||
|
||||
if($coin->hassubmitblock == NULL)
|
||||
{
|
||||
if($coin->hassubmitblock == NULL)
|
||||
{
|
||||
$remote->submitblock('');
|
||||
if(strcasecmp($remote->error, 'method not found') == 0)
|
||||
$coin->hassubmitblock = false;
|
||||
|
@ -101,8 +101,8 @@ function BackendCoinsUpdate()
|
|||
$coin->hassubmitblock = true;
|
||||
}
|
||||
|
||||
if($coin->auxpow == NULL)
|
||||
{
|
||||
if($coin->auxpow == NULL)
|
||||
{
|
||||
$ret = $remote->getauxblock();
|
||||
|
||||
if(strcasecmp($remote->error, 'method not found') == 0)
|
||||
|
|
|
@ -74,8 +74,8 @@ function updateRawcoins()
|
|||
$list = getdbolist('db_coins', "not enable and not installed and id not in (select distinct coinid from markets)");
|
||||
foreach($list as $coin)
|
||||
{
|
||||
debuglog("$coin->symbol is not longer active");
|
||||
$coin->delete();
|
||||
debuglog("$coin->symbol is not longer active");
|
||||
$coin->delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ function BackendRentingUpdate()
|
|||
if(!YAAMP_RENTAL)
|
||||
{
|
||||
dborun("update jobs set active=false, ready=false");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
dborun("update jobs set active=false where not ready");
|
||||
|
@ -128,7 +128,7 @@ function BackendRentingPayout()
|
|||
dborun("delete from shares where algo=:algo and time<$delay", array(':algo'=>$algo));
|
||||
}
|
||||
|
||||
if($total_cleared>0)
|
||||
if($total_cleared>0)
|
||||
debuglog("total cleared from rental $total_cleared BTC");
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ function BackendUpdateDeposit()
|
|||
$rentertx->tx = isset($ts[0]['txid'])? $ts[0]['txid']: '';
|
||||
$rentertx->save();
|
||||
|
||||
$renter->unconfirmed = 0;
|
||||
$renter->unconfirmed = 0;
|
||||
$renter->balance += $a;
|
||||
$renter->updated = time();
|
||||
$renter->save();
|
||||
|
@ -202,7 +202,7 @@ function BackendUpdateDeposit()
|
|||
|
||||
debuglog("unconfirmed $renter->id $renter->address, $a");
|
||||
|
||||
$renter->unconfirmed = $a;
|
||||
$renter->unconfirmed = $a;
|
||||
$renter->updated = time();
|
||||
$renter->save();
|
||||
}
|
||||
|
@ -250,10 +250,10 @@ function BackendUpdateDeposit()
|
|||
continue;
|
||||
}
|
||||
|
||||
$renter->balance -= $tx->amount+$fees;
|
||||
$renter->balance = max($renter->balance, 0);
|
||||
$renter->balance -= $tx->amount+$fees;
|
||||
$renter->balance = max($renter->balance, 0);
|
||||
|
||||
dborun("update renters set balance=$renter->balance where id=$renter->id");
|
||||
dborun("update renters set balance=$renter->balance where id=$renter->id");
|
||||
|
||||
$tx->save();
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ function BackendUpdateServices()
|
|||
$renter->custom_reject += $stat->rejected_speed*1000000000;
|
||||
}
|
||||
|
||||
$renter->save();
|
||||
}
|
||||
$renter->save();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -5,20 +5,20 @@ function BackendStatsUpdate()
|
|||
// debuglog(__FUNCTION__);
|
||||
// $t1xx = microtime(true);
|
||||
|
||||
$t = time()-2*60;
|
||||
$errors = '';
|
||||
$t = time()-2*60;
|
||||
$errors = '';
|
||||
|
||||
$list = getdbolist('db_stratums', "time<$t");
|
||||
foreach($list as $stratum)
|
||||
{
|
||||
debuglog("stratum $stratum->algo terminated");
|
||||
$errors .= "$stratum->algo, ";
|
||||
}
|
||||
$list = getdbolist('db_stratums', "time<$t");
|
||||
foreach($list as $stratum)
|
||||
{
|
||||
debuglog("stratum $stratum->algo terminated");
|
||||
$errors .= "$stratum->algo, ";
|
||||
}
|
||||
|
||||
if(!empty($errors))
|
||||
if(!empty($errors))
|
||||
send_email_alert('stratums', "stratums restarted $errors", "stratums were restarted: $errors");
|
||||
|
||||
dborun("delete from stratums where time<$t");
|
||||
dborun("delete from stratums where time<$t");
|
||||
dborun("delete from workers where pid not in (select pid from stratums)");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -46,11 +46,11 @@ function BackendUsersUpdate()
|
|||
$user->coinid = 0;
|
||||
|
||||
$coins = getdbolist('db_coins', "enable order by difficulty desc");
|
||||
foreach($coins as $coin)
|
||||
{
|
||||
foreach($coins as $coin)
|
||||
{
|
||||
$remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
|
||||
|
||||
$b = $remote->validateaddress($user->username);
|
||||
$b = $remote->validateaddress($user->username);
|
||||
if(!$b || !isset($b['isvalid']) || !$b['isvalid']) continue;
|
||||
|
||||
$user->balance = 0;
|
||||
|
@ -58,7 +58,7 @@ function BackendUsersUpdate()
|
|||
|
||||
debuglog("$user->username set to $coin->symbol, balance $user->balance");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$user->save();
|
||||
}
|
||||
|
|
|
@ -314,4 +314,3 @@ class RecursiveDOMIterator implements RecursiveIterator
|
|||
|
||||
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ function yaamp_convert_earnings_user($user, $status)
|
|||
if(!$refcoin || $refcoin->price2<=0) return 0;
|
||||
|
||||
$value = dboscalar("select sum(amount*price) from earnings where $status and userid=$user->id");
|
||||
$value = $value/$refcoin->price2;
|
||||
$value = $value/$refcoin->price2;
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
|
|
@ -20,45 +20,45 @@ function doBittrexTrading($quick=false)
|
|||
if($coin->dontsell) continue;
|
||||
|
||||
$ticker = bittrex_api_query('public/getticker', "&market=$order->Exchange");
|
||||
if(!$ticker || !$ticker->success || !$ticker->result) continue;
|
||||
if(!$ticker || !$ticker->success || !$ticker->result) continue;
|
||||
|
||||
$ask = bitcoinvaluetoa($ticker->result->Ask);
|
||||
$sellprice = bitcoinvaluetoa($order->Limit);
|
||||
$ask = bitcoinvaluetoa($ticker->result->Ask);
|
||||
$sellprice = bitcoinvaluetoa($order->Limit);
|
||||
|
||||
// flush orders not on the ask
|
||||
if($ask+0.00000005 < $sellprice || $flushall)
|
||||
{
|
||||
if($ask+0.00000005 < $sellprice || $flushall)
|
||||
{
|
||||
// debuglog("bittrex cancel order $order->Exchange $sellprice -> $ask");
|
||||
bittrex_api_query('market/cancel', "&uuid=$order->OrderUuid");
|
||||
bittrex_api_query('market/cancel', "&uuid=$order->OrderUuid");
|
||||
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order->OrderUuid));
|
||||
if($db_order) $db_order->delete();
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order->OrderUuid));
|
||||
if($db_order) $db_order->delete();
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
// add existing orders (shouldnt happen after init)
|
||||
else
|
||||
{
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order->OrderUuid));
|
||||
if($db_order) continue;
|
||||
// add existing orders (shouldnt happen after init)
|
||||
else
|
||||
{
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order->OrderUuid));
|
||||
if($db_order) continue;
|
||||
|
||||
debuglog("adding order $coin->symbol");
|
||||
debuglog("adding order $coin->symbol");
|
||||
|
||||
// $ticker = bittrex_api_query('public/getticker', "&market=$pair");
|
||||
// $ticker = bittrex_api_query('public/getticker', "&market=$pair");
|
||||
// $sellprice = bitcoinvaluetoa($ticker->result->Ask);
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'bittrex';
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $order->Quantity;
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $ticker->result->Ask;
|
||||
$db_order->bid = $ticker->result->Bid;
|
||||
$db_order->uuid = $order->OrderUuid;
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $order->Quantity;
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $ticker->result->Ask;
|
||||
$db_order->bid = $ticker->result->Bid;
|
||||
$db_order->uuid = $order->OrderUuid;
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
}
|
||||
|
||||
// flush obsolete orders
|
||||
|
|
|
@ -21,45 +21,45 @@ function doBleutradeTrading($quick=false)
|
|||
if($coin->dontsell) continue;
|
||||
|
||||
$ticker = bleutrade_api_query('public/getticker', "&market=$pair");
|
||||
if(!$ticker || !$ticker->success || !isset($ticker->result[0])) continue;
|
||||
if(!$ticker || !$ticker->success || !isset($ticker->result[0])) continue;
|
||||
|
||||
$ask = bitcoinvaluetoa($ticker->result[0]->Ask);
|
||||
$sellprice = bitcoinvaluetoa($order->Price);
|
||||
$ask = bitcoinvaluetoa($ticker->result[0]->Ask);
|
||||
$sellprice = bitcoinvaluetoa($order->Price);
|
||||
|
||||
// flush orders not on the ask
|
||||
if($ask+0.00000005 < $sellprice || $flushall)
|
||||
{
|
||||
if($ask+0.00000005 < $sellprice || $flushall)
|
||||
{
|
||||
// debuglog("bleutrade cancel order $order->Exchange $sellprice -> $ask");
|
||||
bleutrade_api_query('market/cancel', "&orderid=$order->OrderId");
|
||||
bleutrade_api_query('market/cancel', "&orderid=$order->OrderId");
|
||||
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order->OrderId));
|
||||
if($db_order) $db_order->delete();
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order->OrderId));
|
||||
if($db_order) $db_order->delete();
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
// add existing orders (shouldnt happen after init)
|
||||
else
|
||||
{
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order->OrderId));
|
||||
if($db_order) continue;
|
||||
// add existing orders (shouldnt happen after init)
|
||||
else
|
||||
{
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order->OrderId));
|
||||
if($db_order) continue;
|
||||
|
||||
debuglog("bleutrade adding order $coin->symbol");
|
||||
debuglog("bleutrade adding order $coin->symbol");
|
||||
|
||||
// $ticker = bleutrade_api_query('public/getticker', "&market=$pair");
|
||||
// $ticker = bleutrade_api_query('public/getticker', "&market=$pair");
|
||||
// $sellprice = bitcoinvaluetoa($ticker->result->Ask);
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'bleutrade';
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $order->Quantity;
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $ticker->result[0]->Ask;
|
||||
$db_order->bid = $ticker->result[0]->Bid;
|
||||
$db_order->uuid = $order->OrderId;
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $order->Quantity;
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $ticker->result[0]->Ask;
|
||||
$db_order->bid = $ticker->result[0]->Bid;
|
||||
$db_order->uuid = $order->OrderId;
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
}
|
||||
|
||||
// flush obsolete orders
|
||||
|
|
|
@ -166,11 +166,11 @@ function doCCexTrading($quick=false)
|
|||
sleep(5);
|
||||
|
||||
$res = $ccex->makeOrder('sell', $pair, $amount, $sellprice);
|
||||
if(!$res || !isset($res['return'])) continue;
|
||||
if(!$res || !isset($res['return'])) continue;
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'c-cex';
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $amount;
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $ticker['sell'];
|
||||
|
|
|
@ -39,35 +39,35 @@ function doCryptsyTrading($quick=false)
|
|||
$sellprice = bitcoinvaluetoa($order['price']);
|
||||
|
||||
// flush orders not on the ask
|
||||
if($ask+0.00000005 < $sellprice || $flushall)
|
||||
{
|
||||
if($ask+0.00000005 < $sellprice || $flushall)
|
||||
{
|
||||
// debuglog("cryptsy cancel order for $coin->symbol ($ask != $sellprice)");
|
||||
cryptsy_api_query('cancelorder', array('orderid'=>$order['orderid']));
|
||||
cryptsy_api_query('cancelorder', array('orderid'=>$order['orderid']));
|
||||
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order['orderid']));
|
||||
if($db_order) $db_order->delete();
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order['orderid']));
|
||||
if($db_order) $db_order->delete();
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
// add existing orders (shouldnt happen after init)
|
||||
else
|
||||
{
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order['orderid']));
|
||||
if($db_order) continue;
|
||||
// add existing orders (shouldnt happen after init)
|
||||
else
|
||||
{
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order['orderid']));
|
||||
if($db_order) continue;
|
||||
|
||||
debuglog("adding order $coin->symbol");
|
||||
debuglog("adding order $coin->symbol");
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'cryptsy';
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $order['quantity'];
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $order['quantity'];
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $ticker->return->$symbol->sellorders[0]->price;
|
||||
$db_order->bid = isset($ticker->return->$symbol->buyorders)? $ticker->return->$symbol->buyorders[0]->price: 0;
|
||||
$db_order->uuid = $order['orderid'];
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
$db_order->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,8 +217,8 @@ function doCryptsyTrading($quick=false)
|
|||
// $withdraw->uuid = $res->result->uuid;
|
||||
$withdraw->save();
|
||||
|
||||
// $savebalance->balance = 0;
|
||||
}
|
||||
// $savebalance->balance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$savebalance->save();
|
||||
|
|
|
@ -8,12 +8,12 @@ function doYobitTrading($quick=false)
|
|||
$coins = getdbolist('db_coins', "installed and id in (select distinct coinid from markets where name='yobit')");
|
||||
foreach($coins as $coin)
|
||||
{
|
||||
if($coin->dontsell) continue;
|
||||
$pair = strtolower("{$coin->symbol}_btc");
|
||||
if($coin->dontsell) continue;
|
||||
$pair = strtolower("{$coin->symbol}_btc");
|
||||
|
||||
$orders = yobit_api_query2('ActiveOrders', array('pair'=>$pair));
|
||||
if(isset($orders['return'])) foreach($orders['return'] as $uuid=>$order)
|
||||
{
|
||||
$orders = yobit_api_query2('ActiveOrders', array('pair'=>$pair));
|
||||
if(isset($orders['return'])) foreach($orders['return'] as $uuid=>$order)
|
||||
{
|
||||
$ticker = yobit_api_query("ticker/$pair");
|
||||
if(!$ticker) continue;
|
||||
|
||||
|
@ -46,7 +46,7 @@ function doYobitTrading($quick=false)
|
|||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$list = getdbolist('db_orders', "coinid=$coin->id and market='yobit'");
|
||||
foreach($list as $db_order)
|
||||
|
@ -71,44 +71,44 @@ function doYobitTrading($quick=false)
|
|||
|
||||
sleep(2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$savebalance = getdbosql('db_balances', "name='yobit'");
|
||||
if(!$savebalance) return;
|
||||
$savebalance = getdbosql('db_balances', "name='yobit'");
|
||||
if(!$savebalance) return;
|
||||
|
||||
$savebalance->balance = 0;
|
||||
$savebalance->balance = 0;
|
||||
|
||||
$balances = yobit_api_query2('getInfo');
|
||||
if(!$balances || !isset($balances['return'])) return;
|
||||
if(!$balances || !isset($balances['return'])) return;
|
||||
|
||||
foreach($balances['return']['funds'] as $symbol=>$amount)
|
||||
{
|
||||
{
|
||||
// debuglog("$symbol, $amount");
|
||||
$amount -= 0.0001;
|
||||
if($amount<=0) continue;
|
||||
if($symbol == 'btc')
|
||||
{
|
||||
$savebalance->balance = $amount;
|
||||
continue;
|
||||
}
|
||||
$amount -= 0.0001;
|
||||
if($amount<=0) continue;
|
||||
if($symbol == 'btc')
|
||||
{
|
||||
$savebalance->balance = $amount;
|
||||
continue;
|
||||
}
|
||||
|
||||
$coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol'=>$symbol));
|
||||
if(!$coin || $coin->dontsell) continue;
|
||||
$coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol'=>$symbol));
|
||||
if(!$coin || $coin->dontsell) continue;
|
||||
|
||||
$market = getdbosql('db_markets', "coinid=$coin->id and name='yobit'");
|
||||
if($market)
|
||||
{
|
||||
$market->lasttraded = time();
|
||||
$market->save();
|
||||
}
|
||||
$market = getdbosql('db_markets', "coinid=$coin->id and name='yobit'");
|
||||
if($market)
|
||||
{
|
||||
$market->lasttraded = time();
|
||||
$market->save();
|
||||
}
|
||||
|
||||
if($amount*$coin->price < 0.00001000) continue;
|
||||
$pair = "{$symbol}_btc";
|
||||
if($amount*$coin->price < 0.00001000) continue;
|
||||
$pair = "{$symbol}_btc";
|
||||
|
||||
$data = yobit_api_query("depth/$pair?limit=11");
|
||||
if(!$data) continue;
|
||||
$data = yobit_api_query("depth/$pair?limit=11");
|
||||
if(!$data) continue;
|
||||
|
||||
$sold_amount = 0;
|
||||
$sold_amount = 0;
|
||||
for($i = 0; $i < 10 && $amount >= 0; $i++)
|
||||
{
|
||||
if(!isset($data->$pair->bids[$i])) break;
|
||||
|
@ -131,7 +131,7 @@ function doYobitTrading($quick=false)
|
|||
}
|
||||
|
||||
$amount -= $sellamount;
|
||||
$sold_amount += $sellamount;
|
||||
$sold_amount += $sellamount;
|
||||
|
||||
// sleep(1);
|
||||
}
|
||||
|
@ -155,9 +155,9 @@ function doYobitTrading($quick=false)
|
|||
if($amount <= 0) continue;
|
||||
|
||||
if($coin->sellonbid)
|
||||
$sellprice = bitcoinvaluetoa($ticker->$pair->buy);
|
||||
else
|
||||
$sellprice = bitcoinvaluetoa($ticker->$pair->sell);
|
||||
$sellprice = bitcoinvaluetoa($ticker->$pair->buy);
|
||||
else
|
||||
$sellprice = bitcoinvaluetoa($ticker->$pair->sell);
|
||||
if($amount*$sellprice < 0.00010000) continue;
|
||||
|
||||
// debuglog("yobit selling $pair, $amount, $sellprice");
|
||||
|
|
|
@ -131,8 +131,8 @@ class ApiController extends CommonController
|
|||
echo "\"paid\": $total_paid, ";
|
||||
echo "\"total\": $total_earned, ";
|
||||
|
||||
echo "\"miners\": ";
|
||||
echo "[";
|
||||
echo "\"miners\": ";
|
||||
echo "[";
|
||||
|
||||
$workers = getdbolist('db_workers', "userid=$user->id order by password");
|
||||
foreach($workers as $i=>$worker)
|
||||
|
@ -154,7 +154,7 @@ class ApiController extends CommonController
|
|||
echo "}";
|
||||
}
|
||||
|
||||
echo "]";
|
||||
echo "]";
|
||||
echo "}";
|
||||
}
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ end;
|
|||
$rentertx->tx = 'scheduled';
|
||||
$rentertx->save();
|
||||
|
||||
debuglog("withdraw scheduled $renter->id $renter->address, $amount to $address");
|
||||
debuglog("withdraw scheduled $renter->id $renter->address, $amount to $address");
|
||||
|
||||
user()->setFlash('message', "withdraw scheduled");
|
||||
$this->redirect("/renting");
|
||||
|
|
|
@ -56,10 +56,10 @@ foreach($list as $job)
|
|||
else
|
||||
echo "<tr class='ssrow'>";
|
||||
|
||||
if($renter && $renter->id == $job->renterid)
|
||||
if($renter && $renter->id == $job->renterid)
|
||||
echo "<td title='$title'>$job->host</td>";
|
||||
else
|
||||
echo "<td title='$title'></td>";
|
||||
else
|
||||
echo "<td title='$title'></td>";
|
||||
|
||||
// echo "<td>$d</td>";
|
||||
// echo "<td>$job->algo</td>";
|
||||
|
|
|
@ -41,7 +41,7 @@ if(controller()->admin)
|
|||
if($renter->id == 7)
|
||||
{
|
||||
// $balance = $renter->custom_balance - $renter->custom_start;
|
||||
$profit = $renter->custom_start + $renter->custom_balance - $spent;
|
||||
$profit = $renter->custom_start + $renter->custom_balance - $spent;
|
||||
|
||||
$start = bitcoinvaluetoa($renter->custom_start);
|
||||
$balance = bitcoinvaluetoa($renter->custom_balance);
|
||||
|
|
|
@ -13,20 +13,20 @@ echo '[[';
|
|||
|
||||
for($i = $t+$step, $j = 0; $i < time(); $i += $step)
|
||||
{
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
|
||||
if($i + $step >= time())
|
||||
{
|
||||
$m = round(yaamp_job_rate($jobid)/1000000, 3);
|
||||
if($i + $step >= time())
|
||||
{
|
||||
$m = round(yaamp_job_rate($jobid)/1000000, 3);
|
||||
// debuglog("last $m");
|
||||
}
|
||||
}
|
||||
|
||||
else if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
$m = round($stats[$j]->hashrate/1000000, 3);
|
||||
$j++;
|
||||
}
|
||||
else if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
$m = round($stats[$j]->hashrate/1000000, 3);
|
||||
$j++;
|
||||
}
|
||||
|
||||
$d = date('Y-m-d H:i:s', $i);
|
||||
echo "[\"$d\",$m]";
|
||||
|
@ -51,14 +51,14 @@ echo '],[';
|
|||
|
||||
for($i = $t+$step, $j = 0; $i < time(); $i += $step)
|
||||
{
|
||||
if($i != $t+$step) echo ',';
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
|
||||
if($i + $step >= time())
|
||||
{
|
||||
$m = round(yaamp_user_rate_bad($jobid)/1000000, 3);
|
||||
// debuglog("last $m");
|
||||
}
|
||||
if($i + $step >= time())
|
||||
{
|
||||
$m = round(yaamp_user_rate_bad($jobid)/1000000, 3);
|
||||
// debuglog("last $m");
|
||||
}
|
||||
|
||||
else if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
|
|
|
@ -71,7 +71,7 @@ foreach($algos as $item)
|
|||
$renting = mbitcoinvaluetoa($renting);
|
||||
|
||||
if($defaultalgo == $algo)
|
||||
echo "<tr style='cursor: pointer; background-color: #e0d3e8;' onclick='javascript:select_algo(\"$algo\")'>";
|
||||
echo "<tr style='cursor: pointer; background-color: #e0d3e8;' onclick='javascript:select_algo(\"$algo\")'>";
|
||||
else
|
||||
echo "<tr style='cursor: pointer' class='ssrow' onclick='javascript:select_algo(\"$algo\")'>";
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ result:
|
|||
"diff": "0.04"
|
||||
},
|
||||
|
||||
...
|
||||
...
|
||||
|
||||
]
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ foreach($algos as $item)
|
|||
$port = getAlgoPort($algo);
|
||||
|
||||
if($defaultalgo == $algo)
|
||||
echo "<tr style='cursor: pointer; background-color: #e0d3e8;' onclick='javascript:select_algo(\"$algo\")'>";
|
||||
echo "<tr style='cursor: pointer; background-color: #e0d3e8;' onclick='javascript:select_algo(\"$algo\")'>";
|
||||
else
|
||||
echo "<tr style='cursor: pointer' class='ssrow' onclick='javascript:select_algo(\"$algo\")'>";
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@ echo '[[';
|
|||
|
||||
for($i = $t+$step, $j = 0; $i < time(); $i += $step)
|
||||
{
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
|
||||
if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
$m = bitcoinvaluetoa($stats[$j]->balance);
|
||||
$j++;
|
||||
}
|
||||
if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
$m = bitcoinvaluetoa($stats[$j]->balance);
|
||||
$j++;
|
||||
}
|
||||
|
||||
$d = date('Y-m-d H:i:s', $i);
|
||||
echo "[\"$d\",$m]";
|
||||
|
@ -29,14 +29,14 @@ echo '],[';
|
|||
|
||||
for($i = $t+$step, $j = 0; $i < time(); $i += $step)
|
||||
{
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
|
||||
if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
$m = bitcoinvaluetoa($stats[$j]->pending);
|
||||
$j++;
|
||||
}
|
||||
if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
$m = bitcoinvaluetoa($stats[$j]->pending);
|
||||
$j++;
|
||||
}
|
||||
|
||||
$d = date('Y-m-d H:i:s', $i);
|
||||
echo "[\"$d\",$m]";
|
||||
|
|
|
@ -20,20 +20,20 @@ echo '[[';
|
|||
|
||||
for($i = $t+$step, $j = 0; $i < time(); $i += $step)
|
||||
{
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
|
||||
if($i + $step >= time())
|
||||
{
|
||||
$m = round(yaamp_user_rate($user->id, $algo)/1000000, 3);
|
||||
// debuglog("last $m");
|
||||
}
|
||||
if($i + $step >= time())
|
||||
{
|
||||
$m = round(yaamp_user_rate($user->id, $algo)/1000000, 3);
|
||||
// debuglog("last $m");
|
||||
}
|
||||
|
||||
else if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
$m = round($stats[$j]->hashrate/1000000, 3);
|
||||
$j++;
|
||||
}
|
||||
else if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
$m = round($stats[$j]->hashrate/1000000, 3);
|
||||
$j++;
|
||||
}
|
||||
|
||||
$d = date('Y-m-d H:i:s', $i);
|
||||
echo "[\"$d\",$m]";
|
||||
|
@ -58,14 +58,14 @@ echo '],[';
|
|||
|
||||
for($i = $t+$step, $j = 0; $i < time(); $i += $step)
|
||||
{
|
||||
if($i != $t+$step) echo ',';
|
||||
if($i != $t+$step) echo ',';
|
||||
$m = 0;
|
||||
|
||||
if($i + $step >= time())
|
||||
{
|
||||
$m = round(yaamp_user_rate_bad($user->id, $algo)/1000000, 3);
|
||||
// debuglog("last $m");
|
||||
}
|
||||
if($i + $step >= time())
|
||||
{
|
||||
$m = round(yaamp_user_rate_bad($user->id, $algo)/1000000, 3);
|
||||
// debuglog("last $m");
|
||||
}
|
||||
|
||||
else if(isset($stats[$j]) && $i > $stats[$j]->time)
|
||||
{
|
||||
|
|
|
@ -57,17 +57,17 @@ foreach($versions as $item)
|
|||
workerid in (select id from workers where algo=:algo and version='$version')", array(':algo'=>$algo));
|
||||
|
||||
$title = '';
|
||||
foreach($error_tab as $i=>$s)
|
||||
{
|
||||
$invalid2 = dboscalar("select sum(difficulty) * $target / $interval / 1000 from shares where error=$i and time>$delay and
|
||||
workerid in (select id from workers where algo=:algo and version='$version')", array(':algo'=>$algo));
|
||||
foreach($error_tab as $i=>$s)
|
||||
{
|
||||
$invalid2 = dboscalar("select sum(difficulty) * $target / $interval / 1000 from shares where error=$i and time>$delay and
|
||||
workerid in (select id from workers where algo=:algo and version='$version')", array(':algo'=>$algo));
|
||||
|
||||
if($invalid2)
|
||||
{
|
||||
$bad2 = round($invalid2*100/($hashrate+$invalid2), 2).'%';
|
||||
$title .= "$bad2 - $s\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$percent = $total_hashrate&&$hashrate? round($hashrate * 100 / $total_hashrate, 2).'%': '';
|
||||
$bad = ($hashrate+$invalid)? round($invalid*100/($hashrate+$invalid), 1).'%': '';
|
||||
|
|
|
@ -28,7 +28,7 @@ foreach($versions as $item)
|
|||
$invalid = dboscalar("select sum(difficulty) * $target / $interval / 1000 from shares where not valid and time>$delay and
|
||||
workerid in (select id from workers where algo=:algo and version=:version)", array(':algo'=>$algo, ':version'=>$version));
|
||||
|
||||
$percent = $hashrate? round($invalid*100/$hashrate, 3): 0;
|
||||
$percent = $hashrate? round($invalid*100/$hashrate, 3): 0;
|
||||
$hashrate = Itoa2($hashrate).'h/s';
|
||||
$invalid = Itoa2($invalid).'h/s';
|
||||
|
||||
|
|
|
@ -164,14 +164,14 @@ class CronjobController extends CommonController
|
|||
memcache_set($this->memcache->memcache, "cronjob_main_time_start", time());
|
||||
if(!YAAMP_PRODUCTION) return;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
$mining = getdbosql('db_mining');
|
||||
if($mining->last_payout + YAAMP_PAYMENTS_FREQ > time()) return;
|
||||
if($mining->last_payout + YAAMP_PAYMENTS_FREQ > time()) return;
|
||||
|
||||
debuglog("--------------------------------------------------------");
|
||||
|
||||
$mining->last_payout = time();
|
||||
$mining->last_payout = time();
|
||||
$mining->save();
|
||||
|
||||
memcache_set($this->memcache->memcache, 'apache_locked', true);
|
||||
|
|
Loading…
Add table
Reference in a new issue