Commit fcdf503b authored by shajiaiming's avatar shajiaiming

返回格式调整

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