Example #1
0
function get_disabled_exchange_pairs()
{
    $pairs = array();
    // add all discovered pairs
    foreach (Exchanges::getAllInstances() as $key => $exchange) {
        // only disabled exchanges
        if (!in_array($key, Exchanges::getDisabled())) {
            continue;
        }
        $persistent = new \Core\PersistentExchange($exchange, db());
        $result = array();
        foreach ($persistent->getMarkets() as $pair) {
            if (in_array($pair[0], get_all_currencies()) && in_array($pair[1], get_all_currencies())) {
                $result[] = $pair;
            }
        }
        $pairs[$key] = $result;
    }
    return $pairs;
}
Example #2
0
<?php

/**
 * Discovered markets within an exchange job.
 */
if (!$exchange) {
    throw new JobException("No exchange defined");
}
$instance = \DiscoveredComponents\Exchanges::getInstance($exchange);
$markets = $instance->fetchMarkets($logger);
$result = array();
foreach ($markets as $m) {
    $result[] = implode("/", $m);
}
$logger->info("Found " . count($markets) . " markets: " . implode(", ", $result));
$persistent = new \Core\PersistentExchange($instance, db());
$persistent->storeMarkets($markets, $logger);
">&lt; Back to Site Status</a>
| <a href="<?php 
echo htmlspecialchars(url_for('admin_reported_currencies', array('only_supported' => 0)));
?>
">All currencies</a>
| <a href="<?php 
echo htmlspecialchars(url_for('admin_reported_currencies', array('only_supported' => 1)));
?>
">Only supported currencies</a>
</p>

<?php 
$matrix = array();
$exchanges = \DiscoveredComponents\Exchanges::getAllInstances();
foreach ($exchanges as $exchange) {
    $persistent = new \Core\PersistentExchange($exchange, db());
    $markets = $persistent->getMarkets();
    $matrix[$exchange->getCode()] = array();
    foreach ($markets as $pair) {
        $c = get_currency_key($pair[0]);
        $matrix[$exchange->getCode()][$c] = 1;
        $all_currencies[$c] = 1;
    }
    foreach ($markets as $pair) {
        $c = get_currency_key($pair[1]);
        $matrix[$exchange->getCode()][$c] = 1;
        $all_currencies[$c] = 1;
    }
}
// add all currencies we natively support
foreach (get_all_currencies() as $cur) {