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

PHP bitcoinvaluetoa函数代码示例

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

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



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

示例1: showUser

function showUser($userid, $what)
{
    $user = getdbo('db_accounts', $userid);
    if (!$user) {
        return;
    }
    $d = datetoa2($user->last_login);
    $balance = bitcoinvaluetoa($user->balance);
    $paid = dboscalar("select sum(amount) from payouts where account_id={$user->id}");
    $paid = bitcoinvaluetoa($paid);
    $t = time() - 24 * 60 * 60;
    $miner_count = getdbocount('db_workers', "userid={$user->id}");
    $share_count = getdbocount('db_shares', "userid={$user->id}");
    $block_count = getdbocount('db_blocks', "userid={$user->id} and time>{$t}");
    $coin = getdbo('db_coins', $user->coinid);
    echo "<tr class='ssrow'>";
    if ($coin) {
        echo "<td><img src='{$coin->image}' width=16> {$coin->symbol}</td>";
    } else {
        echo "<td></td>";
    }
    echo "<td>{$user->id}</td>";
    echo "<td><a href='/site?address={$user->username}'>{$user->username}</a></td>";
    echo "<td>{$what}</td>";
    echo "<td>{$d}</td>";
    echo "<td>{$block_count}</td>";
    echo "<td>{$balance}</td>";
    if (intval($paid) > 0.01) {
        echo "<td><b>{$paid}</b></td>";
    } else {
        echo "<td>{$paid}</td>";
    }
    echo "<td>{$miner_count}</td>";
    echo "<td>{$share_count}</td>";
    if ($user->is_locked) {
        echo "<td>locked</td>";
        echo "<td><a href='/site/unblockuser?wallet={$user->username}'>unblock</a></td>";
    } else {
        echo "<td></td>";
        echo "<td><a href='/site/blockuser?wallet={$user->username}'>block</a></td>";
    }
    echo "</tr>";
}
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:43,代码来源:monsters.php


示例2: foreach

echo "<thead>";
echo "<tr>";
echo "<th>Wallet</th>";
echo "<th>Last</th>";
echo "<th width=20></th>";
echo "<th>Coin</th>";
echo "<th align=right>Pool</th>";
echo "<th align=right>User</th>";
echo "</tr>";
echo "</thead><tbody>";
foreach ($list as $user) {
    $coin = getdbo('db_coins', $user->coinid);
    $balance = bitcoinvaluetoa($user->balance);
    $d = datetoa2($user->last_login);
    echo "<tr class='ssrow'>";
    echo "<td><a href='/?address={$user->username}'><b>{$user->username}</b></a></td>";
    echo "<td>{$d}</td>";
    if ($coin) {
        $coinbalance = bitcoinvaluetoa($coin->balance);
        echo "<td><img width=16 src='{$coin->image}'></td>";
        echo "<td><b><a href='/site/coin?id={$coin->id}'>{$coin->name}</a></b></td>";
        echo "<td align=right>{$coinbalance}</td>";
    } else {
        echo "<td></td>";
        echo "<td></td>";
        echo "<td align=right></td>";
    }
    echo "<td align=right>{$balance}</td>";
    echo "</tr>";
}
echo "</tbody></table>";
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:payments_results.php


示例3: bitcoinvaluetoa

    $total_paid += $paid;
}
echo "</tbody>";
$total_balance = bitcoinvaluetoa($total_balance);
$total_paid = bitcoinvaluetoa($total_paid);
$user_count = count($users);
echo "<tr class='ssrow' style='border-top: 2px solid #eee;'>";
echo "<td><b>Users Total ({$user_count})</b></a></td>";
echo "<td colspan=7></td>";
echo "<td align=right><b>{$total_balance}</b></td>";
echo "<td align=right><b>{$total_paid}</b></td>";
echo "<td></td>";
echo "</tr>";
if ($coin) {
    $balance = bitcoinvaluetoa($coin->balance);
    $profit = bitcoinvaluetoa($balance - $total_balance);
    echo "<tr class='ssrow' style='border-top: 2px solid #eee;'>";
    echo "<td><b>Wallet Balance</b></a></td>";
    echo "<td colspan=7></td>";
    echo "<td align=right><b>{$balance}</b></td>";
    echo "<td colspan=2></td>";
    echo "</tr>";
    echo "<tr class='ssrow' style='border-top: 2px solid #eee;'>";
    echo "<td><b>Wallet Profit</b></a></td>";
    echo "<td colspan=7></td>";
    echo "<td align=right><b>{$profit}</b></td>";
    echo "<td colspan=2></td>";
    echo "</tr>";
}
echo "</table>";
//echo "<p><a href='/site/bonususers'>1% bonus</a></p>";
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:user_results.php


示例4: foreach

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>";
    echo "<td align=right><b>{$amount}</b></td>";
    if ($user->coinid == 6) {
        $txurl = "https://blockchain.info/tx/{$payout->tx}";
    } else {
        $txurl = "/explorer?id={$user->coinid}&txid={$payout->tx}";
    }
    echo "<td style='font-family: monospace;'><a href='{$txurl}' target=_blank>{$payout_tx}</a></td>";
    echo "</tr>";
    $total += $payout->amount;
}
$amount = bitcoinvaluetoa($total);
echo "<tr class='ssrow'>";
echo "<td align=right>Total:</td>";
echo "<td align=right><b>{$amount}</b></td>";
echo "<td></td>";
echo "</tr>";
echo "</table><br>";
echo "</div>";
echo "</div><br>";
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:wallet_results.php


示例5: dborow

$row3 = dborow("select avg(hashrate) as a, sum(earnings) as b from hashstats where time>{$t3} and algo=:algo", array(':algo' => $algo));
if ($row1['a'] > 0 && $row2['a'] > 0 && $row3['a'] > 0) {
    $btcmhday1 = bitcoinvaluetoa($row1['b'] / $row1['a'] * 1000000 / 2);
    $btcmhday2 = bitcoinvaluetoa($row2['b'] / $row2['a'] * 1000000 / 7);
    $btcmhday3 = bitcoinvaluetoa($row3['b'] / $row3['a'] * 1000000 / 30);
} else {
    $btcmhday1 = 0;
    $btcmhday2 = 0;
    $btcmhday3 = 0;
}
$hashrate1 = Itoa2($row1['a']);
$hashrate2 = Itoa2($row2['a']);
$hashrate3 = Itoa2($row3['a']);
$total1 = bitcoinvaluetoa($row1['b']);
$total2 = bitcoinvaluetoa($row2['b']);
$total3 = bitcoinvaluetoa($row3['b']);
$height = '240px';
$algos = yaamp_get_algos();
$string = '';
foreach ($algos as $a) {
    if ($a == $algo) {
        $string .= "<option value='{$a}' selected>{$a}</option>";
    } else {
        $string .= "<option value='{$a}'>{$a}</option>";
    }
}
echo <<<end

<div id='resume_update_button' style='color: #444; background-color: #ffd; border: 1px solid #eea;
\tpadding: 10px; margin-left: 20px; margin-right: 20px; margin-top: 15px; cursor: pointer; display: none;'
\tonclick='auto_page_resume();' align=center>
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:index.php


示例6: actionTitle_results

 public function actionTitle_results()
 {
     $user = getuserparam(getparam('address'));
     if ($user) {
         $balance = bitcoinvaluetoa($user->balance);
         $coin = getdbo('db_coins', $user->coinid);
         if ($coin) {
             echo "{$balance} {$coin->symbol} - yaamp.com";
         } else {
             echo "{$balance} - yaamp.com";
         }
     } else {
         echo "yaamp.com";
     }
 }
开发者ID:zarethernet,项目名称:yaamp,代码行数:15,代码来源:SiteController.php


示例7: 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


示例8: 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


示例9: datetoa2

                     }
                 }
             }
         }
     }
 }
 if ($exchange->status == 'waiting') {
     echo "<tr style='background-color: #e0d3e8;'>";
 } else {
     echo "<tr class='ssrow'>";
 }
 $sent = datetoa2($exchange->send_time) . ' ago';
 $received = $exchange->receive_time ? sectoa($exchange->receive_time - $exchange->send_time) : '';
 $price = $exchange->price ? bitcoinvaluetoa($exchange->price) : bitcoinvaluetoa($coin->price);
 $estimate = bitcoinvaluetoa($exchange->price_estimate);
 $total = $exchange->price ? bitcoinvaluetoa($exchange->quantity * $exchange->price) : bitcoinvaluetoa($exchange->quantity * $coin->price);
 echo "<td><img width=16 src='{$coin->image}'></td>";
 echo "<td><b><a href='/site/coin?id={$coin->id}'>{$coin->name} ({$coin->symbol})</a></b></td>";
 echo "<td><b><a href='{$marketurl}' target=_blank>{$exchange->market}</a></b></td>";
 echo "<td>{$sent}</td>";
 echo "<td>{$exchange->quantity}</td>";
 echo "<td>{$estimate}</td>";
 echo "<td>{$price}</td>";
 echo $total > 0.01 ? "<td><b>{$total}</b></td>" : "<td>{$total}</td>";
 echo "<td>";
 if ($exchange->status == 'waiting') {
     //	echo "<a href='/site/clearexchange?id=$exchange->id'>[clear]</a>";
     echo "<a href='/site/deleteexchange?id={$exchange->id}'>[del]</a>";
 }
 echo "</td>";
 echo "</tr>";
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:exchange_results.php


示例10: getBestMarket

echo "<thead class=''>";
echo "<tr>";
echo "<th>Name</th>";
echo "<th>Price</th>";
echo "<th>Price2</th>";
echo "<th>Sent</th>";
echo "<th>Traded</th>";
echo "<th>Late</th>";
echo "<th>Deposit</th>";
echo "<th>Message</th>";
echo "</tr>";
echo "</thead><tbody>";
$bestmarket = getBestMarket($coin);
foreach ($list as $market) {
    $price = bitcoinvaluetoa($market->price);
    $price2 = bitcoinvaluetoa($market->price2);
    $lowsymbol = strtolower($coin->symbol);
    if ($market->name == 'cryptsy') {
        $marketurl = "https://www.cryptsy.com/markets/view/{$market->marketid}";
    } else {
        if ($market->name == 'bittrex') {
            $marketurl = "https://bittrex.com/Market/Index?MarketName=BTC-{$coin->symbol}";
        } else {
            if ($market->name == 'mintpal') {
                $marketurl = "https://www.mintpal.com/market/{$coin->symbol}/BTC";
            } else {
                if ($market->name == 'poloniex') {
                    $marketurl = "https://poloniex.com/exchange/btc_{$coin->symbol}";
                } else {
                    if ($market->name == 'bleutrade') {
                        $marketurl = "https://bleutrade.com/exchange/{$coin->symbol}/BTC";
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:coin_results.php


示例11: time

}
$step = 15 * 60;
$t = time() - 24 * 60 * 60;
$stats = getdbolist('db_balanceuser', "time>{$t} and userid={$user->id} order by time");
echo '[[';
for ($i = $t + $step, $j = 0; $i < time(); $i += $step) {
    if ($i != $t + $step) {
        echo ',';
    }
    $m = 0;
    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}]";
}
echo '],[';
for ($i = $t + $step, $j = 0; $i < time(); $i += $step) {
    if ($i != $t + $step) {
        echo ',';
    }
    $m = 0;
    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}]";
}
echo ']]';
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:graph_earnings_results.php


示例12: foreach

echo "<br><table class='dataGrid'>";
echo "<thead>";
echo "<tr>";
echo "<th></th>";
echo "<th>Name</th>";
echo "<th align=right>Amount</th>";
echo "<th align=right>Diff</th>";
echo "<th align=right>Block</th>";
echo "<th align=right>Time</th>";
echo "<th align=right>Status</th>";
echo "</tr>";
echo "</thead>";
foreach ($db_blocks as $db_block) {
    $d = datetoa2($db_block->time);
    if (!$db_block->coin_id) {
        $reward = bitcoinvaluetoa($db_block->amount);
        $algo_color = getAlgoColors($db_block->algo);
        echo "<tr style='background-color:{$algo_color};'>";
        echo "<td width=18><img width=16 src='/images/btc.png'></td>";
        echo "<td><b>Rental</b> ({$db_block->algo})</td>";
        echo "<td align=right style='font-size: .8em'><b>{$reward} BTC</b></td>";
        echo "<td align=right style='font-size: .8em'></td>";
        echo "<td align=right style='font-size: .8em'></td>";
        echo "<td align=right style='font-size: .8em'>{$d} ago</td>";
        echo "<td align=right style='font-size: .8em'>";
        echo "<span style='padding: 2px; color: white; background-color: #5cb85c'>Confirmed</span>";
        echo "</td>";
        echo "</tr>";
        continue;
    }
    $coin = getdbo('db_coins', $db_block->coin_id);
开发者ID:Excalibur201010,项目名称:yiimp,代码行数:31,代码来源:common_results.php


示例13: user

<?php

$algo = user()->getState('yaamp-algo');
$t = time() - 48 * 60 * 60;
$stats = getdbolist('db_hashstats', "time>{$t} and algo=:algo", array(':algo' => $algo));
echo '[';
foreach ($stats as $i => $n) {
    $m = $n->hashrate ? bitcoinvaluetoa($n->earnings * 24 * 1000000 / $n->hashrate) : 0;
    if ($i) {
        echo ',';
    }
    $d = date('Y-m-d H:i:s', $n->time);
    echo "[\"{$d}\",{$m}]";
}
echo ']';
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:15,代码来源:graph_results_3.php


示例14: doBleutradeTrading

function doBleutradeTrading($quick = false)
{
    $flushall = rand(0, 4) == 0;
    if ($quick) {
        $flushall = false;
    }
    //	debuglog("-------------- dobleutradeTrading() flushall $flushall");
    $orders = bleutrade_api_query('market/getopenorders');
    if (!$orders) {
        return;
    }
    foreach ($orders->result as $order) {
        $e = explode('_', $order->Exchange);
        $symbol = $e[0];
        /// "Exchange" : "LTC_BTC",
        $pair = $order->Exchange;
        $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol));
        if (!$coin) {
            continue;
        }
        if ($coin->dontsell) {
            continue;
        }
        $ticker = bleutrade_api_query('public/getticker', "&market={$pair}");
        if (!$ticker || !$ticker->success || !isset($ticker->result[0])) {
            continue;
        }
        $ask = bitcoinvaluetoa($ticker->result[0]->Ask);
        $sellprice = bitcoinvaluetoa($order->Price);
        // flush orders not on the ask
        if ($ask + 5.0E-8 < $sellprice || $flushall) {
            //			debuglog("bleutrade cancel order $order->Exchange $sellprice -> $ask");
            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();
            }
            sleep(1);
        } else {
            $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $order->OrderId));
            if ($db_order) {
                continue;
            }
            debuglog("bleutrade adding order {$coin->symbol}");
            //	$ticker = bleutrade_api_query('public/getticker', "&market=$pair");
            //	$sellprice = bitcoinvaluetoa($ticker->result->Ask);
            $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();
        }
    }
    // flush obsolete orders
    $list = getdbolist('db_orders', "market='bleutrade'");
    foreach ($list as $db_order) {
        $coin = getdbo('db_coins', $db_order->coinid);
        if (!$coin) {
            continue;
        }
        $found = false;
        foreach ($orders->result as $order) {
            if ($order->OrderId == $db_order->uuid) {
                $found = true;
                break;
            }
        }
        if (!$found) {
            debuglog("bleutrade deleting order {$coin->name} {$db_order->amount}");
            $db_order->delete();
        }
    }
    // 	if($flushall)
    // 	{
    //		debuglog("bleutrade flushall got here");
    // 		return;
    // 	}
    sleep(2);
    // add orders
    $balances = bleutrade_api_query('account/getbalances');
    //	debuglog($balances);
    if (!$balances || !isset($balances->result) || !$balances->success) {
        return;
    }
    $savebalance = getdbosql('db_balances', "name='bleutrade'");
    $savebalance->balance = 0;
    foreach ($balances->result as $balance) {
        if ($balance->Currency == 'BTC') {
            $savebalance->balance = $balance->Available;
            continue;
        }
        $amount = floatval($balance->Available);
        if (!$amount) {
            continue;
        }
//.........这里部分代码省略.........
开发者ID:Excalibur201010,项目名称:yiimp,代码行数:101,代码来源:bleutrade_trading.php


示例15: user

<?php

$algo = user()->getState('yaamp-algo');
JavascriptFile("/extensions/jqplot/jquery.jqplot.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.dateAxisRenderer.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.barRenderer.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.highlighter.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.cursor.js");
JavascriptFile('/yaamp/ui/js/auto_refresh.js');
$this->widget('UniForm');
$balance = bitcoinvaluetoa($renter->balance);
echo <<<END

<table cellspacing=20 width=100%>
<tr><td valign=top width=50%>

<!--  -->

<div id='balance_results'></div>
<div id='orders_results'></div>

</td><td valign=top>

<div id='pool_current_results'>
<br><br><br><br><br><br><br><br><br><br>
</div>

<div id='all_orders_results'></div>

<div class="main-left-box">
<div class="main-left-title">Last 24 Hours Renting ({$algo})</div>
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:index.php


示例16: foreach

echo "<th></th>";
echo "<th>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);
    echo "<tr class='ssrow'>";
    echo "<td width=18></td>";
    echo "<td><b>{$d} ago</b></td>";
    echo "<td align=right><b>{$amount}</b></td>";
    if ($user->coinid == $bitcoin->id) {
        echo "<td style='font-family: monospace;'><a href='https://blockchain.info/tx/{$payout->tx}' target=_blank>{$payout->tx}</a></td>";
    } else {
        echo "<td style='font-family: monospace;'><a href='/explorer?id={$user->coinid}&txid={$payout->tx}' target=_blank>{$payout->tx}</a></td>";
    }
    echo "</tr>";
    $total += $payout->amount;
}
$total = bitcoinvaluetoa($total);
echo "<tr class='ssrow' style='border-top: 2px solid #eee;'>";
echo "<td width=18></td>";
echo "<td><b>Total</b></td>";
echo "<td align=right><b>{$total}</b></td>";
echo "<td></td>";
echo "</tr>";
echo "</table><br>";
echo "</div></div><br>";
开发者ID:Excalibur201010,项目名称:yiimp,代码行数:31,代码来源:tx.php


示例17: foreach

echo "<tr>";
echo "<td></td>";
echo "<th>Name</th>";
echo "<th align=right>Amount</th>";
echo "<th align=right>Percent</th>";
echo "<th align=right>mBTC</th>";
echo "<th align=right>Time</th>";
echo "<th align=right>Status</th>";
echo "</tr>";
echo "</thead>";
foreach ($earnings as $earning) {
    $coin = getdbo('db_coins', $earning->coinid);
    $block = getdbo('db_blocks', $earning->blockid);
    $d = datetoa2($earning->create_time);
    if (!$coin) {
        $reward = bitcoinvaluetoa($earning->amount);
        $value = altcoinvaluetoa($earning->amount * 1000);
        $percent = $block ? mbitcoinvaluetoa($earning->amount * 100 / $block->amount) : '';
        $algo = $block ? $block->algo : '';
        echo "<tr class='ssrow'>";
        echo "<td width=18><img width=16 src='/images/btc.png'></td>";
        echo "<td><b>Rental</b><span style='font-size: .8em'> ({$algo})</span></td>";
        echo "<td align=right style='font-size: .8em'><b>{$reward} BTC</b></td>";
        echo "<td align=right style='font-size: .8em'>{$percent}%</td>";
        echo "<td align=right style='font-size: .8em'>{$value}</td>";
        echo "<td align=right style='font-size: .8em'>{$d} ago</td>";
        echo "<td align=right style='font-size: .8em'>Cleared</td>";
        echo "</tr>";
        continue;
    }
    $reward = altcoinvaluetoa($earning->amount);
开发者ID:zarethernet,项目名称:yaamp,代码行数:31,代码来源:user_earning_results.php


示例18: doCCexTrading


//.........这里部分代码省略.........
            $found = false;
            foreach ($orders['return'] as $uuid => $order) {
                if ($uuid == $db_order->uuid) {
                    $found = true;
                    break;
                }
            }
            if (!$found) {
                debuglog("c-cex deleting order {$coin->name} {$db_order->amount}");
                $db_order->delete();
            }
        }
    }
    sleep(2);
    //////////////////////////////////////////////////////////////////////////////////////////////////
    $savebalance = getdbosql('db_balances', "name='c-cex'");
    $savebalance->balance = 0;
    //	debuglog("c-cex getbalance");
    sleep(5);
    $balances = $ccex->getBalance();
    if (!$balances || !isset($balances['return'])) {
        return;
    }
    foreach ($balances['return'] as $balance) {
        foreach ($balance as $symbol => $amount) {
            if (!$amount) {
                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='c-cex'");
            if ($market) {
                $market->lasttraded = time();
                $market->save();
            }
            if ($amount * $coin->price < 1.0E-5) {
                continue;
            }
            $pair = "{$symbol}-btc";
            ////////////////////////
            $maxprice = 0;
            $maxamount = 0;
            //		debuglog("c-cex list order for $pair all");
            sleep(5);
            $orders = $ccex->getOrders($pair, 0);
            foreach ($orders['return'] as $order) {
                if ($order['type'] == 'sell') {
                    continue;
                }
                if ($order['price'] > $maxprice) {
                    $maxprice = $order['price'];
                    $maxamount = $order['amount'];
                }
            }
            //	debuglog("maxbuy for $pair $maxamount $maxprice");
            if ($amount >= $maxamount && $maxamount * $maxprice > 1.0E-5) {
                $sellprice = bitcoinvaluetoa($maxprice);
                debuglog("c-cex selling market {$pair}, {$maxamount}, {$sellprice}");
                sleep(5);
                $res = $ccex->makeOrder('sell', $pair, $maxamount, $sellprice);
                if (!$res || !isset($res['return'])) {
                    debuglog($res);
                } else {
                    $amount -= $maxamount;
                }
                sleep(1);
            }
            ///
            $ticker = $ccex->getTickerInfo($pair);
            if (!$ticker) {
                continue;
            }
            $sellprice = bitcoinvaluetoa($ticker['sell']);
            //		debuglog("c-cex selling $pair, $amount, $sellprice");
            sleep(5);
            $res = $ccex->makeOrder('sell', $pair, $amount, $sellprice);
            if (!$res || !isset($res['return'])) {
                continue;
            }
            $db_order = new db_orders();
            $db_order->market = 'c-cex';
            $db_order->coinid = $coin->id;
            $db_order->amount = $amount;
            $db_order->price = $sellprice;
            $db_order->ask = $ticker['sell'];
            $db_order->bid = $ticker['buy'];
            $db_order->uuid = $res['return'];
            $db_order->created = time();
            $db_order->save();
        }
    }
    $savebalance->save();
    //	debuglog('-------------- doCCexTrading() done');
}
开发者ID:zarethernet,项目名称:yaamp,代码行数:101,代码来源:c-cex_trading.php


示例19: foreach

    return;
}
echo "<table class='dataGrid'>";
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>Address</th>";
echo "<th align=right>Time</th>";
echo "<th align=right>Type</th>";
echo "<th align=right>Amount</th>";
echo "<th>Tx</th>";
echo "</tr>";
echo "</thead>";
foreach ($list as $tx) {
    $d = datetoa2($tx->time);
    $amount = bitcoinvaluetoa($tx->amount);
    $renter = getdbo('db_renters', $tx->renterid);
    if (!$renter) {
        continue;
    }
    echo "<tr class='ssrow'>";
    echo "<td>{$renter->id}</td>";
    echo "<td><a href='/renting?address={$renter->address}'>{$renter->address}</a></td>";
    echo "<td align=right><b>{$d} ago</b></td>";
    echo "<td align=right title='{$tx->address}'>{$tx->type}</td>";
    echo "<td align=right><b>{$amount}</b></td>";
    if (strlen($tx->tx) > 32) {
        $tx_show = substr($tx->tx, 0, 36) . '...';
        $txurl = "https://blockchain.info/tx/{$tx->tx}";
        echo "<td style='font-family: monospace;'><a href='{$txurl}' target=_blank>{$tx_show}</a></td>";
    } else {
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:admin.php


示例20: getdbo

该文章已有0人参与评论

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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