Commit fcdf503b authored by shajiaiming's avatar shajiaiming

返回格式调整

parent 72719f2d
...@@ -33,12 +33,14 @@ class BinanceBuilder ...@@ -33,12 +33,14 @@ class BinanceBuilder
foreach ($this->base_coin as $k => $coin) { foreach ($this->base_coin as $k => $coin) {
$explode_arr = explode($coin, $val['symbol']); $explode_arr = explode($coin, $val['symbol']);
if (2 == count($explode_arr) && empty($explode_arr[1])) { if (2 == count($explode_arr) && empty($explode_arr[1])) {
$ticker[$val['symbol']]['symbol'] = $explode_arr[0] . '/' . $coin; $temp = [];
$ticker[$val['symbol']]['close'] = (float)sprintf("%0.4f", $val['lastPrice']); $temp['symbol'] = $explode_arr[0] . '/' . $coin;
$ticker[$val['symbol']]['change'] = (float)sprintf("%0.4f", $val['priceChangePercent']); $temp['close'] = (float)sprintf("%0.4f", $val['lastPrice']);
$ticker[$val['symbol']]['high'] = (float)sprintf("%0.4f", $val['highPrice']); $temp['change'] = (float)sprintf("%0.4f", $val['priceChangePercent']);
$ticker[$val['symbol']]['low'] = (float)sprintf("%0.4f", $val['lowPrice']); $temp['high'] = (float)sprintf("%0.4f", $val['highPrice']);
$ticker[$val['symbol']]['vol'] = (float)sprintf("%0.4f", $val['volume']); $temp['low'] = (float)sprintf("%0.4f", $val['lowPrice']);
$temp['vol'] = (float)sprintf("%0.4f", $val['volume']);
array_push($ticker, $temp);
} }
} }
} }
......
...@@ -33,12 +33,14 @@ class HuobiBuilder ...@@ -33,12 +33,14 @@ class HuobiBuilder
foreach ($this->base_coin as $k => $coin) { foreach ($this->base_coin as $k => $coin) {
$explode_arr = explode(strtolower($coin), $val['symbol']); $explode_arr = explode(strtolower($coin), $val['symbol']);
if (2 == count($explode_arr) && empty($explode_arr[1])) { if (2 == count($explode_arr) && empty($explode_arr[1])) {
$ticker[$val['symbol']]['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin; $temp = [];
$ticker[$val['symbol']]['close'] = (float)sprintf("%0.4f", $val['close']); $temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin;
$ticker[$val['symbol']]['change'] = (float)sprintf("%0.4f", ($val['close'] - $val['open']) / $val['open'] * 100); $temp['close'] = (float)sprintf("%0.4f", $val['close']);
$ticker[$val['symbol']]['high'] = (float)sprintf("%0.4f", $val['high']); $temp['change'] = (float)sprintf("%0.4f", ($val['close'] - $val['open']) / $val['open'] * 100);
$ticker[$val['symbol']]['low'] = (float)sprintf("%0.4f", $val['low']); $temp['high'] = (float)sprintf("%0.4f", $val['high']);
$ticker[$val['symbol']]['vol'] = (float)sprintf("%0.4f", $val['vol']); $temp['low'] = (float)sprintf("%0.4f", $val['low']);
$temp['vol'] = (float)sprintf("%0.4f", $val['vol']);
array_push($ticker, $temp);
} }
} }
} }
......
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