Commit 322e8854 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/ticker' into 'master'

fix See merge request !389
parents bc76b3ca 2755cf58
...@@ -36,9 +36,7 @@ class Bitnasdaq extends Exchange implements ExchangeInterface ...@@ -36,9 +36,7 @@ class Bitnasdaq extends Exchange implements ExchangeInterface
if (is_array($res) && isset($res['data'])) { if (is_array($res) && isset($res['data'])) {
$data = $res['data']['ticker']; $data = $res['data']['ticker'];
foreach ($data as $key => $item) { foreach ($data as $key => $item) {
if (strpos(strtoupper($key), '_CNYT') !== false) { if (in_array(strtoupper($item['symbol']), ['BNCUSAT', 'BTCUSAT', 'ETCUSAT', 'ETHUSAT', 'GHPUSAT', 'LTCUSAT'])) {
continue;
}
$low = isset($item['low']) ? $item['low'] : 0; $low = isset($item['low']) ? $item['low'] : 0;
$high = isset($item['high']) ? $item['high'] : 0; $high = isset($item['high']) ? $item['high'] : 0;
$last = isset($item['last']) ? $item['last'] : 0; $last = isset($item['last']) ? $item['last'] : 0;
...@@ -51,5 +49,6 @@ class Bitnasdaq extends Exchange implements ExchangeInterface ...@@ -51,5 +49,6 @@ class Bitnasdaq extends Exchange implements ExchangeInterface
} }
} }
} }
}
} }
...@@ -62,7 +62,8 @@ class BitnasdaqBuilder extends FactoryService ...@@ -62,7 +62,8 @@ class BitnasdaqBuilder extends FactoryService
$ticker = []; $ticker = [];
foreach ($keys as $val) { foreach ($keys as $val) {
foreach ($this->basic_coin as $k => $coin) { foreach ($this->basic_coin as $k => $coin) {
$explode_arr = explode(strtoupper($coin), strtoupper($val)); $temp_symbol = str_replace('USAT', 'USDT', $val);
$explode_arr = explode(strtoupper($coin), strtoupper($temp_symbol));
if (2 == count($explode_arr) && empty($explode_arr[1])) { if (2 == count($explode_arr) && empty($explode_arr[1])) {
if (false != $condition) { if (false != $condition) {
list($low, $high, $close, $open, $vol, $change) = $this->redis_ticker->hmget($this->quotation_prefix . strtoupper($val), 'low', 'high', 'last', 'open', 'vol', 'change'); list($low, $high, $close, $open, $vol, $change) = $this->redis_ticker->hmget($this->quotation_prefix . strtoupper($val), 'low', 'high', 'last', 'open', 'vol', 'change');
...@@ -70,9 +71,9 @@ class BitnasdaqBuilder extends FactoryService ...@@ -70,9 +71,9 @@ class BitnasdaqBuilder extends FactoryService
list($low, $high, $close, $open, $vol, $change) = $this->redis->hmget($this->quotation_prefix . strtolower($val), 'low', 'high', 'last', 'open', 'vol', 'change'); list($low, $high, $close, $open, $vol, $change) = $this->redis->hmget($this->quotation_prefix . strtolower($val), 'low', 'high', 'last', 'open', 'vol', 'change');
} }
$temp = []; $temp = [];
$temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin; $temp['symbol'] = strtoupper($explode_arr[0]) . '/USAT';
$temp['currency'] = strtoupper($explode_arr[0]); $temp['currency'] = strtoupper($explode_arr[0]);
$temp['base_currency'] = strtoupper($coin); $temp['base_currency'] = 'USAT';
$temp['close'] = rtrim(sprintf('%.8f', floatval($close)), '0'); $temp['close'] = rtrim(sprintf('%.8f', floatval($close)), '0');
$temp['close_usd'] = rtrim(sprintf('%.6f', floatval($close * $this->basic_price[$coin]['usd'])), '0'); $temp['close_usd'] = rtrim(sprintf('%.6f', floatval($close * $this->basic_price[$coin]['usd'])), '0');
$temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']); $temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']);
...@@ -111,12 +112,13 @@ class BitnasdaqBuilder extends FactoryService ...@@ -111,12 +112,13 @@ class BitnasdaqBuilder extends FactoryService
$temp = []; $temp = [];
$temp['symbol'] = strtoupper($symbol); $temp['symbol'] = strtoupper($symbol);
$temp['close'] = $close; $temp['close'] = $close;
foreach ($this->basic_coin as $k => $coin) { //为什么要加close_rmb作为排序
$explode_arr = explode(strtoupper($coin), strtoupper($symbol)); // foreach ($this->basic_coin as $k => $coin) {
if (2 == count($explode_arr) && empty($explode_arr[1])) { // $explode_arr = explode(strtoupper($coin), strtoupper($symbol));
$temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']); // if (2 == count($explode_arr) && empty($explode_arr[1])) {
} // $temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']);
} // }
// }
$temp['low'] = $low; $temp['low'] = $low;
$temp['high'] = $high; $temp['high'] = $high;
$temp['open'] = $open; $temp['open'] = $open;
...@@ -127,7 +129,7 @@ class BitnasdaqBuilder extends FactoryService ...@@ -127,7 +129,7 @@ class BitnasdaqBuilder extends FactoryService
$this->redis_ticker->hmset($key, 'low', $low, 'high', $high, 'last', $close, 'open', $open, 'vol', $vol, 'change', $change); $this->redis_ticker->hmset($key, 'low', $low, 'high', $high, 'last', $close, 'open', $open, 'vol', $vol, 'change', $change);
} }
$ticker_sort_close = Tools::arraySort($ticker, 'close_rmb'); $ticker_sort_close = Tools::arraySort($ticker, 'close');
$this->redis_ticker->del($this->supported_symbol_close_asc); $this->redis_ticker->del($this->supported_symbol_close_asc);
$this->redis_ticker->del($this->supported_symbol_close_desc); $this->redis_ticker->del($this->supported_symbol_close_desc);
foreach ($ticker_sort_close as $val) { foreach ($ticker_sort_close as $val) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment