• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP getdbolist函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getdbolist函数的典型用法代码示例。如果您正苦于以下问题:PHP getdbolist函数的具体用法?PHP getdbolist怎么用?PHP getdbolist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getdbolist函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: doPoloniexTrading

function doPoloniexTrading()
{
    //	debuglog('-------------- doPoloniexTrading()');
    $flushall = rand(0, 4) == 0;
    $poloniex = new poloniex();
    $tickers = $poloniex->get_ticker();
    if (!$tickers) {
        return;
    }
    // upgrade orders
    $coins = getdbolist('db_coins', "enable and id in (select distinct coinid from markets where name='poloniex')");
    foreach ($coins as $coin) {
        if ($coin->dontsell) {
            continue;
        }
        $pair = "BTC_{$coin->symbol}";
        if (!isset($tickers[$pair])) {
            continue;
        }
        $orders = $poloniex->get_open_orders($pair);
        if (!$orders || !isset($orders[0])) {
            dborun("delete from orders where coinid={$coin->id} and market='poloniex'");
            continue;
        }
        foreach ($orders as $order) {
            if (!isset($order['orderNumber'])) {
                debuglog($order);
                continue;
            }
            if ($order['rate'] > $tickers[$pair]['lowestAsk'] + 5.0E-8 || $flushall) {
                //				debuglog("poloniex cancel order for $pair {$order['orderNumber']}");
                $poloniex->cancel_order($pair, $order['orderNumber']);
                $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $order['orderNumber']));
                if ($db_order) {
                    $db_order->delete();
                }
                sleep(1);
            } else {
                $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $order['orderNumber']));
                if ($db_order) {
                    continue;
                }
                debuglog("poloniex adding order {$coin->symbol}");
                $db_order = new db_orders();
                $db_order->market = 'poloniex';
                $db_order->coinid = $coin->id;
                $db_order->amount = $order['amount'];
                $db_order->price = $order['rate'];
                $db_order->ask = $tickers[$pair]['lowestAsk'];
                $db_order->bid = $tickers[$pair]['highestBid'];
                $db_order->uuid = $order['orderNumber'];
                $db_order->created = time();
                $db_order->save();
            }
        }
        $list = getdbolist('db_orders', "coinid={$coin->id} and market='poloniex'");
        foreach ($list as $db_order) {
            $found = false;
            foreach ($orders as $order) {
                if (!isset($order['orderNumber'])) {
                    debuglog($order);
                    continue;
                }
                if ($order['orderNumber'] == $db_order->uuid) {
                    $found = true;
                    break;
                }
            }
            if (!$found) {
                debuglog("poloniex deleting order {$coin->name} {$db_order->amount}");
                $db_order->delete();
            }
        }
    }
    // add orders
    $savebalance = getdbosql('db_balances', "name='poloniex'");
    $balances = $poloniex->get_balances();
    foreach ($balances as $symbol => $balance) {
        if (!$balance) {
            continue;
        }
        if ($symbol == 'BTC') {
            $savebalance->balance = $balance;
            $savebalance->save();
            continue;
        }
        $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol));
        if (!$coin || $coin->dontsell) {
            continue;
        }
        $market = getdbosql('db_markets', "coinid={$coin->id} and name='poloniex'");
        if ($market) {
            $market->lasttraded = time();
            $market->save();
        }
        $pair = "BTC_{$symbol}";
        if (!isset($tickers[$pair])) {
            continue;
        }
        $sellprice = $tickers[$pair]['highestBid'];
//.........这里部分代码省略.........
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:101,代码来源:poloniex_trading.php


示例2: BackendClearEarnings

function BackendClearEarnings()
{
    //	debuglog(__FUNCTION__);
    $delay = time() - 150 * 60;
    $total_cleared = 0;
    $list = getdbolist('db_earnings', "status=1 and mature_time<{$delay}");
    foreach ($list as $earning) {
        $user = getdbo('db_accounts', $earning->userid);
        if (!$user) {
            $earning->delete();
            continue;
        }
        $coin = getdbo('db_coins', $earning->coinid);
        if (!$coin) {
            $earning->delete();
            continue;
        }
        $earning->status = 2;
        // cleared
        $earning->price = $coin->price;
        $earning->save();
        // 		$refcoin = getdbo('db_coins', $user->coinid);
        // 		if($refcoin && $refcoin->price<=0) continue;
        // 		$value = $earning->amount * $coin->price / ($refcoin? $refcoin->price: 1);
        $value = yaamp_convert_amount_user($coin, $earning->amount, $user);
        $user->balance += $value;
        $user->save();
        if ($user->coinid == 6) {
            $total_cleared += $value;
        }
    }
    if ($total_cleared > 0) {
        debuglog("total cleared from mining {$total_cleared} BTC");
    }
}
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:35,代码来源:clear.php


示例3: TradingSellCoins

function TradingSellCoins()
{
    //	debuglog(__FUNCTION__);
    $coins = getdbolist('db_coins', "enable and balance>0 and symbol!='BTC'");
    foreach ($coins as $coin) {
        sellCoinToExchange($coin);
    }
}
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:8,代码来源:sell.php


示例4: doTrading

 public function doTrading()
 {
     $this->orders = $this->loadOrders();
     foreach ($this->orders as $order) {
         $cexcoin = new CExchangeCoin($order->coin, $this->marketname);
         // cancel if too high
         // add to our db if not there already
     }
     $list = getdbolist('db_orders', "market='{$this->marketname}'");
     foreach ($list as $db_order) {
         $found = false;
         foreach ($this->orders as $order) {
             if ($order->orderid == $db_order->uuid) {
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             debuglog("{$this->marketname} deleting order");
             $db_order->delete();
         }
     }
     $savebalance = getdbosql('db_balances', "name='cryptsy'");
     $savebalance->balance = 0;
     $this->balances = $this->loadBalances();
     foreach ($this->balances as $balance) {
         if ($balance->amount <= 0) {
             continue;
         }
         $cexcoin = new CExchangeCoin($balance->coin, $this->marketname);
         foreach ($cexcoin->bids as $bid) {
             if ($balance->amount * 1.5 < $bid->amount && !$coin->sellonbid) {
                 break;
             }
             $sellamount = min($balance->amount, $bid->price);
             if ($sellamount * $bid->price < $this->get_mintrade()) {
                 continue;
             }
             $cex->sell($sellamount, $bid->price);
             $balance->amount -= $sellamount;
             sleep(1);
         }
         $cexcoin = new CExchangeCoin($balance->coin, $this->marketname);
         if ($balance->amount * $cexcoin->ask < $this->get_mintrade()) {
             continue;
         }
         $cex->sell($balance->amount, $cexcoin->ask);
         sleep(1);
     }
     if ($this->balance_btc >= $this->get_minwithdraw()) {
         debuglog("withdraw {$this->marketname} {$this->balance_btc}");
         $this->withdraw($this->balance_btc);
     }
 }
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:54,代码来源:CExchange.php


示例5: BackendQuickClean

function BackendQuickClean()
{
    $delay = time() - 24 * 60 * 60;
    $coins = getdbolist('db_coins', "installed");
    foreach ($coins as $coin) {
        $id = dboscalar("select id from blocks where coin_id={$coin->id} and time<{$delay} and\r\n\t\t\tid not in (select blockid from earnings where coinid={$coin->id})\r\n\t\t\torder by id desc limit 200, 1");
        if ($id) {
            dborun("delete from blocks where coin_id={$coin->id} and time<{$delay} and\r\n\t\t\tid not in (select blockid from earnings where coinid={$coin->id}) and id<{$id}");
        }
    }
    dborun("delete from earnings where blockid in (select id from blocks where category='orphan')");
    dborun("delete from earnings where blockid not in (select id from blocks)");
}
开发者ID:zarethernet,项目名称:yaamp,代码行数:13,代码来源:system.php


示例6: yaamp_profitability

function yaamp_profitability($coin)
{
    if (!$coin->difficulty) {
        return 0;
    }
    $btcmhd = 20116.56761169 / $coin->difficulty * $coin->reward * $coin->price;
    if (!$coin->auxpow && $coin->rpcencoding == 'POW') {
        $listaux = getdbolist('db_coins', "enable and visible and auto_ready and auxpow and algo='{$coin->algo}'");
        foreach ($listaux as $aux) {
            if (!$aux->difficulty) {
                continue;
            }
            $btcmhdaux = 20116.56761169 / $aux->difficulty * $aux->reward * $aux->price;
            $btcmhd += $btcmhdaux;
        }
    }
    if ($coin->algo == 'sha256') {
        $btcmhd *= 1000;
    }
    return $btcmhd;
}
开发者ID:zarethernet,项目名称:yaamp,代码行数:21,代码来源:yaamp.php


示例7: doYobitTrading

function doYobitTrading($quick = false)
{
    $flushall = rand(0, 4) == 0;
    if ($quick) {
        $flushall = 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");
        $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;
                }
                if ($order['rate'] > $ticker->{$pair}->sell + 5.0E-8 || $flushall) {
                    //				debuglog("yobit cancel order for $pair $uuid");
                    $res = yobit_api_query2('CancelOrder', array('order_id' => $uuid));
                    $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $uuid));
                    if ($db_order) {
                        $db_order->delete();
                    }
                    sleep(1);
                } else {
                    $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $uuid));
                    if ($db_order) {
                        continue;
                    }
                    debuglog("yobit adding order {$coin->symbol}");
                    $db_order = new db_orders();
                    $db_order->market = 'yobit';
                    $db_order->coinid = $coin->id;
                    $db_order->amount = $order['amount'];
                    $db_order->price = $order['rate'];
                    $db_order->ask = $ticker->{$pair}->sell;
                    $db_order->bid = $ticker->{$pair}->buy;
                    $db_order->uuid = $uuid;
                    $db_order->created = time();
                    $db_order->save();
                }
            }
        }
        $list = getdbolist('db_orders', "coinid={$coin->id} and market='yobit'");
        foreach ($list as $db_order) {
            $found = false;
            if (isset($orders['return'])) {
                foreach ($orders['return'] as $uuid => $order) {
                    if ($uuid == $db_order->uuid) {
                        $found = true;
                        break;
                    }
                }
            }
            if (!$found) {
                debuglog("yobit deleting order {$coin->name} {$db_order->amount}");
                $db_order->delete();
            }
        }
    }
    sleep(2);
    //////////////////////////////////////////////////////////////////////////////////////////////////
    $savebalance = getdbosql('db_balances', "name='yobit'");
    if (!$savebalance) {
        return;
    }
    $savebalance->balance = 0;
    $balances = yobit_api_query2('getInfo');
    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;
        }
        $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();
        }
        if ($amount * $coin->price < 1.0E-5) {
            continue;
        }
        $pair = "{$symbol}_btc";
        $data = yobit_api_query("depth/{$pair}?limit=11");
        if (!$data) {
            continue;
//.........这里部分代码省略.........
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:101,代码来源:yobit_trading.php


示例8: BackendCoinPayments

function BackendCoinPayments($coin)
{
    //	debuglog("BackendCoinPayments $coin->symbol");
    $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
    $info = $remote->getinfo();
    if (!$info) {
        debuglog("{$coin->symbol} cant connect to coin");
        return;
    }
    $min = 0.001;
    // 	if(date("w", time()) == 0 && date("H", time()) > 12)		// sunday afternoon
    // 		$min = 0.0001;
    $users = getdbolist('db_accounts', "balance>{$min} and coinid={$coin->id}");
    if ($coin->symbol == 'MUE' || $coin->symbol == 'DIME') {
        foreach ($users as $user) {
            $user = getdbo('db_accounts', $user->id);
            if (!$user) {
                continue;
            }
            $amount = $user->balance;
            while ($user->balance > $min && $amount > $min) {
                debuglog("{$coin->symbol} sendtoaddress {$user->username} {$amount}");
                $tx = $remote->sendtoaddress($user->username, round($amount, 8));
                if (!$tx) {
                    debuglog("error {$remote->error}, {$user->username}, {$amount}");
                    if ($remote->error == 'transaction too large' || $remote->error == 'invalid amount') {
                        $amount /= 2;
                        continue;
                    }
                    break;
                }
                $payout = new db_payouts();
                $payout->account_id = $user->id;
                $payout->time = time();
                $payout->amount = bitcoinvaluetoa($amount);
                $payout->fee = 0;
                $payout->tx = $tx;
                $payout->save();
                $user->balance -= $amount;
                $user->save();
            }
        }
        debuglog("payment done");
        return;
    }
    $total_to_pay = 0;
    $addresses = array();
    foreach ($users as $user) {
        $total_to_pay += round($user->balance, 8);
        $addresses[$user->username] = round($user->balance, 8);
    }
    if (!$total_to_pay) {
        //	debuglog("nothing to pay");
        return;
    }
    if ($info['balance'] - 0.001 < $total_to_pay) {
        debuglog("{$coin->symbol} wallet insufficient funds for payment {$info['balance']} < {$total_to_pay}");
        return;
    }
    if ($coin->symbol == 'BTC') {
        global $cold_wallet_table;
        $balance = $info['balance'];
        $stats = getdbosql('db_stats', "1 order by time desc");
        $renter = dboscalar("select sum(balance) from renters");
        $pie = $balance - $total_to_pay - $renter - 1;
        debuglog("pie to split is {$pie}");
        if ($pie > 0) {
            foreach ($cold_wallet_table as $coldwallet => $percent) {
                $coldamount = round($pie * $percent, 8);
                if ($coldamount < $min) {
                    break;
                }
                debuglog("paying cold wallet {$coldwallet} {$coldamount}");
                $addresses[$coldwallet] = $coldamount;
                $total_to_pay += $coldamount;
            }
        }
    }
    debuglog("paying {$total_to_pay} {$coin->symbol} min is {$min}");
    $tx = $remote->sendmany('', $addresses, 1, '');
    if (!$tx) {
        debuglog($remote->error);
        return;
    }
    foreach ($users as $user) {
        $user = getdbo('db_accounts', $user->id);
        if (!$user) {
            continue;
        }
        $payout = new db_payouts();
        $payout->account_id = $user->id;
        $payout->time = time();
        $payout->amount = bitcoinvaluetoa($user->balance);
        $payout->fee = 0;
        $payout->tx = $tx;
        $payout->save();
        $user->balance = 0;
        $user->save();
    }
    debuglog("payment done");
//.........这里部分代码省略.........
开发者ID:zarethernet,项目名称:yaamp,代码行数:101,代码来源:payment.php


示例9: getdbolist

echo "<thead>";
echo "<tr>";
echo "<th>Renter</th>";
echo "<th>Job</th>";
echo "<th>Address</th>";
echo "<th>Algo</th>";
echo "<th>Host</th>";
echo "<th>Max Price</th>";
echo "<th>Max Hash</th>";
echo "<th>Current Hash</th>";
echo "<th>Difficulty</th>";
echo "<th>Ready</th>";
echo "<th>Active</th>";
echo "</tr>";
echo "</thead><tbody>";
$list = getdbolist('db_jobs', "ready");
foreach ($list as $job) {
    $hashrate = yaamp_job_rate($job->id);
    $hashrate = $hashrate ? Itoa2($hashrate) . 'h/s' : '';
    $speed = Itoa2($job->speed) . 'h/s';
    $renter = getdbo('db_renters', $job->renterid);
    if (!$renter) {
        continue;
    }
    if ($deposit == $renter->address) {
        echo "<tr class='ssrow' style='background-color: #dfd'>";
    } else {
        echo "<tr class='ssrow'>";
    }
    echo "<td>{$job->renterid}</td>";
    echo "<td>{$job->id}</td>";
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:admin.php


示例10: BackendStatsUpdate2

function BackendStatsUpdate2()
{
    //	debuglog('----------------------------------');
    //	debuglog(__FUNCTION__);
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    $step = 15;
    $t = floor(time() / $step / 60) * $step * 60;
    $list = dbolist("select userid, algo from shares where time>{$t} group by userid, algo");
    foreach ($list as $item) {
        $stats = getdbosql('db_hashuser', "time={$t} and algo=:algo and userid=:userid", array(':algo' => $item['algo'], ':userid' => $item['userid']));
        if (!$stats) {
            $stats = new db_hashuser();
            $stats->userid = $item['userid'];
            $stats->time = $t;
            $stats->hashrate = dboscalar("select hashrate from hashuser where algo=:algo and userid=:userid order by time desc limit 1", array(':algo' => $item['algo'], ':userid' => $item['userid']));
            $stats->hashrate_bad = 0;
            $stats->algo = $item['algo'];
        }
        $percent = 20;
        $user_rate = yaamp_user_rate($item['userid'], $item['algo']);
        $stats->hashrate = round(($stats->hashrate * (100 - $percent) + $user_rate * $percent) / 100);
        if ($stats->hashrate < 1000) {
            $stats->hashrate = 0;
        }
        $user_rate_bad = yaamp_user_rate_bad($item['userid'], $item['algo']);
        $stats->hashrate_bad = round(($stats->hashrate_bad * (100 - $percent) + $user_rate_bad * $percent) / 100);
        if ($stats->hashrate_bad < 1000) {
            $stats->hashrate_bad = 0;
        }
        $stats->save();
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    $step = 15;
    $t = floor(time() / $step / 60) * $step * 60;
    $list = dbolist("select distinct jobid from jobsubmits where time>{$t}");
    foreach ($list as $item) {
        $jobid = $item['jobid'];
        $stats = getdbosql('db_hashrenter', "time={$t} and jobid={$jobid}");
        if (!$stats) {
            $stats = new db_hashrenter();
            //	$stats->renterid = ;
            $stats->jobid = $item['jobid'];
            $stats->time = $t;
            $stats->hashrate = dboscalar("select hashrate from hashrenter where jobid=:jobid order by time desc limit 1", array(':jobid' => $jobid));
            $stats->hashrate_bad = 0;
            //dboscalar("select hashrate_bad from hashrenter where jobid=$jobid order by time desc limit 1");
        }
        $percent = 20;
        $job_rate = yaamp_job_rate($jobid);
        $stats->hashrate = round(($stats->hashrate * (100 - $percent) + $job_rate * $percent) / 100);
        if ($stats->hashrate < 1000) {
            $stats->hashrate = 0;
        }
        $job_rate_bad = yaamp_job_rate_bad($jobid);
        $stats->hashrate_bad = round(($stats->hashrate_bad * (100 - $percent) + $job_rate_bad * $percent) / 100);
        if ($stats->hashrate_bad < 1000) {
            $stats->hashrate_bad = 0;
        }
        $stats->save();
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    $t = floor(time() / $step / 60) * $step * 60;
    $d = time() - 24 * 60 * 60;
    $list = getdbolist('db_accounts', "balance>0 or last_login>{$d}");
    foreach ($list as $user) {
        $stats = getdbosql('db_balanceuser', "time={$t} and userid={$user->id}");
        if (!$stats) {
            $stats = new db_balanceuser();
            $stats->userid = $user->id;
            $stats->time = $t;
        }
        // 		$refcoin = getdbo('db_coins', $user->coinid);
        // 		if(!$refcoin) $refcoin = getdbosql('db_coins', "symbol='BTC'");
        // 		if(!$refcoin->price || !$refcoin->price2) continue;
        // 		$pending1 = dboscalar("select sum(amount*price) from earnings where coinid=$refcoin->id and status!=2 and userid=$user->id");
        // 		$pending2 = dboscalar("select sum(amount*price) from earnings where coinid!=$refcoin->id and status!=2 and userid=$user->id");
        $stats->pending = yaamp_convert_earnings_user($user, "status!=2");
        $stats->pending = bitcoinvaluetoa($stats->pending);
        $stats->balance = $user->balance;
        $stats->save();
        $id = dboscalar("select id from earnings where userid={$user->id} order by id desc limit 100, 1");
        if ($id) {
            dborun("delete from earnings where status=2 and userid={$user->id} and id<{$id}");
        }
    }
}
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:86,代码来源:stats.php


示例11: getiparam

<?php

$id = getiparam('id');
if ($id) {
    $db_blocks = getdbolist('db_blocks', "coin_id=:id order by time desc limit 250", array(':id' => $id));
} else {
    $db_blocks = getdbolist('db_blocks', "1 order by time desc limit 250");
}
echo "<table class='dataGrid'>";
//showTableSorter('maintable');
echo "<thead>";
echo "<tr>";
echo "<th width=20></th>";
echo "<th>Name</th>";
echo "<th>Time</th>";
echo "<th>Height</th>";
echo "<th>Amount</th>";
echo "<th>Status</th>";
echo "<th>Difficulty</th>";
echo "<th>Found Diff</th>";
echo "<th>Blockhash</th>";
echo "</tr>";
echo "</thead><tbody>";
foreach ($db_blocks as $db_block) {
    if (!$db_block->coin_id) {
        continue;
    }
    $coin = getdbo('db_coins', $db_block->coin_id);
    if (!$coin) {
        continue;
    }
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:block_results.php


示例12: getparam

<?php

/////////////////////////////////////////////////////////////////////////////////////////////////
$symbol = getparam('symbol');
$coin = null;
if ($symbol == 'all') {
    $users = getdbolist('db_accounts', "balance>.001 order by balance desc");
} else {
    $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol));
    if (!$coin) {
        return;
    }
    $users = getdbolist('db_accounts', "balance>.001 and coinid={$coin->id} order by balance desc");
}
//echo "<br><table class='dataGrid'>";
showTableSorter('maintable');
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>Wallet</th>";
echo "<th>Last</th>";
echo "<th align=right>Miners</th>";
echo "<th align=right>Hashrate</th>";
echo "<th align=right>Bad</th>";
echo "<th></th>";
echo "<th align=right>Blocks</th>";
echo "<th align=right>Diff/Paid</th>";
echo "<th align=right>Balance</th>";
echo "<th align=right>Total Paid</th>";
echo "<th></th>";
echo "</tr>";
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:user_results.php


示例13: user

<?php

$algo = user()->getState('yaamp-algo');
$s = 24 * 60 * 60;
$t = time() - 60 * 24 * 60 * 60;
$stats = getdbolist('db_hashstats', "time>{$t} and algo=:algo", array(':algo' => $algo));
$res = array();
$first = 0;
foreach ($stats as $n) {
    $i = floor($n->time / $s) * $s;
    if (!$first) {
        $first = $i;
    }
    if (!isset($res[$i])) {
        $res[$i] = 0;
    }
    $res[$i] += $n->earnings;
}
echo '[';
foreach ($res as $i => $n) {
    if ($i != $first) {
        echo ',';
    }
    $d = date('Y-m-d H:i:s', $i);
    echo "[\"{$d}\",{$n}]";
}
echo ']';
开发者ID:zarethernet,项目名称:yaamp,代码行数:27,代码来源:graph_results_8.php


示例14: WriteBoxHeader

<?php

function WriteBoxHeader($title)
{
    echo "<div class='main-left-box'>";
    echo "<div class='main-left-title'>{$title}</div>";
    echo "<div class='main-left-inner'>";
}
$algo = user()->getState('yaamp-algo');
$total_rate = Itoa2(yaamp_pool_rate());
$list = getdbolist('db_coins', "enable and algo=:algo order by index_avg desc", array(':algo' => $algo));
$count = count($list);
$worker = getdbocount('db_workers', "algo=:algo", array(':algo' => $algo));
$services = getdbolist('db_services', "algo=:algo order by price desc", array(':algo' => $algo));
////////////
$table = array('scrypt' => 0, 'sha256' => 1, 'scryptn' => 2, 'x11' => 3, 'x13' => 4, 'x15' => 6, 'nist5' => 7, 'neoscrypt' => 8, 'lyra2' => 9);
$res = fetch_url("https://www.nicehash.com/api?method=orders.get&algo={$table[$algo]}");
if (!$res) {
    return;
}
$a = json_decode($res);
$niceorders = $a->result->orders;
$allorders = array();
$nicehash = getdbosql('db_nicehash', "algo=:algo and orderid!=0", array(':algo' => $algo));
if ($nicehash) {
    $index = $nicehash->price * 1000 + 1;
    $allorders[$index] = array();
    $allorders[$index]['speed'] = $nicehash->accepted;
    $allorders[$index]['price'] = $nicehash->price;
    $allorders[$index]['workers'] = $nicehash->workers;
    $allorders[$index]['btc'] = $nicehash->btc;
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:mining_results.php


示例15: bitcoinvaluetoa

$total_earned = bitcoinvaluetoa($total_unsold + $balance + $total_paid);
//$total_earned_usd = number_format($total_earned*$mining->usdbtc*$refcoin->price, 3, '.', ' ');
echo "<tr class='ssrow' style='border-top: 3px solid #eee;'>";
echo "<td><img width=16 src='{$refcoin->image}'></td>";
echo "<td colspan=3><b>Total Earned</b></td>";
echo "<td align=right style='font-size: .8em;'></td>";
echo "<td align=right style='font-size: .9em;'>{$total_earned} {$refcoin->symbol}</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
$usd = number_format($mining->usdbtc, 2, '.', ' ');
echo "<p style='font-size: .8em'>\r\n\t&nbsp;* approximate from current exchange rates<br>\r\n\t&nbsp;** bitstamp <b>{$usd}</b> USD/BTC\r\n\t</p>";
echo "</div><br>";
WriteBoxHeader("Last 24 Hours Payouts: {$user->username}");
$t = time() - 24 * 60 * 60;
$list = getdbolist('db_payouts', "account_id={$user->id} and time>{$t} order by time desc");
echo "<table  class='dataGrid2'>";
echo "<thead>";
echo "<tr>";
echo "<th align=right>Time</th>";
echo "<th align=right>Amount</th>";
echo "<th>Tx</th>";
echo "</tr>";
echo "</thead>";
$total = 0;
foreach ($list as $payout) {
    $d = datetoa2($payout->time);
    $amount = bitcoinvaluetoa($payout->amount);
    $payout_tx = substr($payout->tx, 0, 36) . '...';
    echo "<tr class='ssrow'>";
    echo "<td align=right><b>{$d} ago</b></td>";
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:wallet_results.php


示例16: getdbolist

echo "<tr>";
echo "<th>ID</th>";
echo "<th>Algo</th>";
echo "<th>BTC</th>";
echo "<th>Nicehash</th>";
echo "<th>Yaamp</th>";
echo "<th>Price</th>";
echo "<th>Speed</th>";
echo "<th>Last Dec</th>";
echo "<th>Workers</th>";
echo "<th>Accepted</th>";
echo "<th>Rejected</th>";
echo "<th></th>";
echo "</tr>";
echo "</thead><tbody>";
$list = getdbolist('db_nicehash');
foreach ($list as $nicehash) {
    $price2 = mbitcoinvaluetoa(dboscalar("select price from services where algo='{$nicehash->algo}'") * 1000);
    $d = datetoa2($nicehash->last_decrease);
    $yaamp = mbitcoinvaluetoa(dboscalar("select price from hashrate where algo='{$nicehash->algo}' order by time desc limit 1"));
    echo "<tr class='ssrow'>";
    echo "<td>{$nicehash->orderid}</td>";
    echo "<td>{$nicehash->algo}</td>";
    echo "<td>{$nicehash->btc}</td>";
    echo "<td>{$price2}</td>";
    if ($yaamp > $price2 * 1.1) {
        echo "<td style='color: #4a4'>{$yaamp}</td>";
    } else {
        echo "<td>{$yaamp}</td>";
    }
    if ($nicehash->price > $yaamp) {
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:index_results.php


示例17: dboscalar

<?php

$last = dboscalar("select max(last) from connections");
$list = getdbolist('db_connections', "1 order by id desc");
echo count($list) . " connections<br>";
//echo "<table class='dataGrid'>";
showTableSorter('maintable');
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>User</th>";
echo "<th>Host</th>";
echo "<th>Db</th>";
echo "<th>Idle</th>";
echo "<th>Created</th>";
echo "<th>Last</th>";
echo "<th></th>";
echo "</tr>";
echo "</thead><tbody>";
foreach ($list as $conn) {
    echo "<tr class='ssrow'>";
    $d1 = sectoa($conn->idle);
    $d2 = datetoa2($conn->created);
    $d3 = datetoa2($conn->last);
    $b = Booltoa($conn->last == $last);
    echo "<td>{$conn->id}</td>";
    echo "<td>{$conn->user}</td>";
    echo "<td>{$conn->host}</td>";
    echo "<td>{$conn->db}</td>";
    echo "<td>{$d1}</td>";
    echo "<td>{$d2}</td>";
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:connections_results.php


示例18: time

<?php

$percent = 16;
$step = 15 * 60;
$t = time() - 24 * 60 * 60;
$stats = getdbolist('db_stats', "time>{$t} order by time");
echo '[[';
foreach ($stats as $i => $n) {
    $m = round($n->margin - $n->renters, 8);
    if ($i) {
        echo ',';
    }
    $d = date('Y-m-d H:i:s', $n->time);
    echo "[\"{$d}\",{$m}]";
}
echo '],[';
foreach ($stats as $i => $n) {
    //	$m = round($n->margin+$n->balances, 8);
    $m = round($n->balances, 8);
    if ($i) {
        echo ',';
    }
    $d = date('Y-m-d H:i:s', $n->time);
    echo "[\"{$d}\",{$m}]";
}
echo '],[';
foreach ($stats as $i => $n) {
    //	$m = round($n->margin+$n->balances+$n->onsell, 8);
    $m = round($n->onsell, 8);
    if ($i) {
        echo ',';
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:graph_assets_results.php


示例19: user

<?php

$percent = 16;
$algo = user()->getState('yaamp-algo');
$step = 15 * 60;
$t = time() - 24 * 60 * 60;
$stats = getdbolist('db_hashrate', "time>{$t} and algo=:algo order by time", array(':algo' => $algo));
$averages = array();
echo '[[';
for ($i = 0; $i < 95 - count($stats); $i++) {
    $d = date('Y-m-d H:i:s', $t);
    echo "[\"{$d}\",0],";
    $averages[] = array($d, 0);
    $t += $step;
}
foreach ($stats as $i => $n) {
    $m = round($n->hashrate / 1000000, 3);
    if ($i) {
        echo ',';
    }
    $d = date('Y-m-d H:i:s', $n->time);
    echo "[\"{$d}\",{$m}]";
    $averages[] = array($d, $m);
}
echo '],[';
$average = $averages[0][1];
foreach ($averages as $i => $n) {
    if ($i) {
        echo ',';
    }
    $average = ($average * (100 - $percent) + $n[1] * $percent) / 100;
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:graph_hashrate_results.php


示例20: doBittrexTrading

function doBittrexTrading($quick = false)
{
    $flushall = rand(0, 4) == 0;
    if ($quick) {
        $flushall = false;
    }
    //	debuglog("-------------- doBittrexTrading() flushall $flushall");
    $orders = bittrex_api_query('market/getopenorders');
    if (!$orders || !$orders->success) {
        return;
    }
    foreach ($orders->result as $order) {
        $symbol = substr($order->Exchange, 4);
        $pair = $order->Exchange;
        $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol));
        if (!$coin) {
            continue;
        }
        if ($coin->dontsell) {
            continue;
        }
        $ticker = bittrex_api_query('public/getticker', "&market={$order->Exchange}");
        if (!$ticker || !$ticker->success || !$ticker->result) {
            continue;
        }
        $ask = bitcoinvaluetoa($ticker->result->Ask);
        $sellprice = bitcoinvaluetoa($order->Limit);
        // flush orders not on the ask
        if ($ask + 5.0E-8 < $sellprice || $flushall) {
            // 			debuglog("bittrex cancel order $order->Exchange $sellprice -> $ask");
            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();
            }
            sleep(1);
        } else {
            $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $order->OrderUuid));
            if ($db_order) {
                continue;
            }
            debuglog("adding order {$coin->symbol}");
            //	$ticker = bittrex_api_query('public/getticker', "&market=$pair");
            //	$sellprice = bitcoinvaluetoa($ticker->result->Ask);
            $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;
  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getdbosql函数代码示例发布时间:2022-05-15
下一篇:
PHP getdbo函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap