コード例 #1
0
ファイル: discovered.php プロジェクト: phpsource/openclerk
        $query = array();
        $args = array();
        foreach ($data as $key => $value) {
            $query[] = $key . " = :" . $key;
            $args[$key] = $value;
        }
        $args["id"] = $this->account['id'];
        crypto_log("Self-updating table '{$table}'");
        $q = db()->prepare("UPDATE {$table} SET " . implode(", ", $query) . " WHERE id=:id");
        $q->execute($args);
    }
}
if ($instance instanceof \Account\SelfUpdatingAccount) {
    $callback = new SelfUpdatingAccountCallback($account, $table);
    $instance->registerAccountUpdateCallback(array($callback, 'callback'));
}
// normal balances
$balances = $instance->fetchBalances($account, $factory, $logger);
foreach ($balances as $currency => $balance) {
    // only store currencies we are actually interested in
    if (in_array($currency, \DiscoveredComponents\Currencies::getKeys())) {
        // some accounts, e.g. ghash, don't return a balance
        if (isset($balance['confirmed'])) {
            insert_new_balance($job, $account, $exchange, $currency, $balance['confirmed']);
        }
        // hashrate balances
        if (isset($balance['hashrate'])) {
            insert_new_hashrate($job, $account, $exchange, $currency, $balance['hashrate'] / 1000000.0);
        }
    }
}
コード例 #2
0
ファイル: crypto.php プロジェクト: phpsource/openclerk
function get_currency_abbr($c)
{
    if (in_array($c, Currencies::getKeys())) {
        $currency = Currencies::getInstance($c);
        return $currency->getAbbr();
    }
    return strtoupper($c);
}