你好,
当我尝试获取比特币黄金和 nimiq 的当前价格时,我遇到了问题。
当我打电话给fetch_ticker
我得到了 Bitgem 和 NetCoin。 这似乎与https://github.com/ccxt/ccxt/issues/348 、 https://github.com/ccxt/ccxt/issues/1147和
https://github.com/ccxt/ccxt/issues/867
目前 coinmarketcap 上有 1398 种货币。 我认为名称重叠在未来不是唯一的。 但是怎么对付他们呢?
在https://github.com/ccxt/ccxt/issues/348你告诉过,市值较高的硬币获胜。 但它似乎在 PHP 中不起作用。
提前致谢
$cmc = new \ccxt\coinmarketcap();
print_r($cmc->fetch_ticker('BTG/USD'));
print_r($cmc->fetch_ticker('NET/USD'));
$found = false;
foreach ($cmc->fetch_tickers() as $ticker) {
if($ticker['info']['id'] == 'nimiq') {
$found = true;
}
}
var_export($found);
(
[symbol] => BTG/USD
[timestamp] => 1515601740000
[datetime] => 2018-01-10T16:29:00.000+00:00
[high] =>
[low] =>
[bid] =>
[ask] =>
[vwap] =>
[open] =>
[close] =>
[first] =>
[last] => 11.1172
[change] => 11.21
[percentage] =>
[average] =>
[baseVolume] =>
[quoteVolume] => 17999.5
[info] => Array
(
[id] => bitgem
[name] => Bitgem
[symbol] => BTG
[rank] => 828
[price_usd] => 11.1172
[price_btc] => 0.00075009
[24h_volume_usd] => 17999.5
[market_cap_usd] => 664864.0
[available_supply] => 59805.0
[total_supply] => 59805.0
[max_supply] =>
[percent_change_1h] => 3.64
[percent_change_24h] => 11.21
[percent_change_7d] => 95.0
[last_updated] => 1515601740
)
)
Array
(
[symbol] => NET/USD
[timestamp] => 1515601741000
[datetime] => 2018-01-10T16:29:01.000+00:00
[high] =>
[low] =>
[bid] =>
[ask] =>
[vwap] =>
[open] =>
[close] =>
[first] =>
[last] => 0.00844807
[change] => -11.78
[percentage] =>
[average] =>
[baseVolume] =>
[quoteVolume] => 112679
[info] => Array
(
[id] => netcoin
[name] => NetCoin
[symbol] => NET
[rank] => 568
[price_usd] => 0.00844807
[price_btc] => 0.00000057
[24h_volume_usd] => 112679.0
[market_cap_usd] => 6649702.0
[available_supply] => 787126712.0
[total_supply] => 787126712.0
[max_supply] =>
[percent_change_1h] => 3.11
[percent_change_24h] => -11.78
[percent_change_7d] => 298.4
[last_updated] => 1515601741
)
)
false
非常感谢😄
@slideup-benni 感谢您的报告!
没问题
不幸的是,我刚刚找到了另一个:Basic Attention Token BAT,但它返回BatCoin。